# Generated by Django 3.1.2 on 2020-10-05 19:29
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations
from django.db import models

# Functions from the following migrations need manual copying.
# Move them and any dependencies into this file, then update the
# RunPython operations to refer to the local versions:


class Migration(migrations.Migration):

    initial = True

    replaces = []

    dependencies = [("api", "0001_initial")]

    operations = [
        ###### begin customization; preserve this if you squash migrations ######
        migrations.RunSQL(
            """
            DROP TABLE IF EXISTS "worker_cache_table";
            CREATE TABLE "worker_cache_table" (
                "cache_key" varchar(255) NOT NULL PRIMARY KEY,
                "value" text NOT NULL,
                "expires" timestamp with time zone NOT NULL
            );
            DROP INDEX IF EXISTS "worker_cache_table_expires";
            CREATE INDEX "worker_cache_table_expires" ON "worker_cache_table" ("expires");
            """
        ),
        ###### end customization ######
        migrations.CreateModel(
            name="CostUsageReportManifest",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("assembly_id", models.TextField()),
                ("manifest_creation_datetime", models.DateTimeField(default=django.utils.timezone.now, null=True)),
                ("manifest_updated_datetime", models.DateTimeField(default=django.utils.timezone.now, null=True)),
                ("manifest_completed_datetime", models.DateTimeField(null=True)),
                ("manifest_modified_datetime", models.DateTimeField(null=True)),
                ("billing_period_start_datetime", models.DateTimeField()),
                ("num_total_files", models.IntegerField()),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.provider")),
            ],
            options={"unique_together": {("provider", "assembly_id")}},
        ),
        migrations.CreateModel(
            name="RegionMapping",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("region", models.CharField(max_length=32, unique=True)),
                ("region_name", models.CharField(max_length=64, unique=True)),
            ],
            options={"db_table": "region_mapping"},
        ),
        migrations.CreateModel(
            name="CostUsageReportStatus",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("report_name", models.CharField(max_length=128)),
                ("last_completed_datetime", models.DateTimeField(null=True)),
                ("last_started_datetime", models.DateTimeField(null=True)),
                ("etag", models.CharField(max_length=64, null=True)),
                (
                    "manifest",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="reporting_common.costusagereportmanifest",
                    ),
                ),
            ],
            options={"unique_together": {("manifest", "report_name")}},
        ),
    ]
