<reponame>Vasyka/koku
# Generated by Django 2.2.9 on 2020-01-16 22:32
import django.contrib.postgres.fields.jsonb
import django.contrib.postgres.indexes
import django.db.models.deletion
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

    replaces = []

    initial = True

    dependencies = [
        ("api", "0001_initial_squashed_0008_auto_20190305_2015"),
        ("api", "0009_providerstatus_squashed_0042_auto_20200116_2048"),
    ]

    operations = [
        migrations.CreateModel(
            name="AWSAccountAlias",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("account_id", models.CharField(max_length=50, unique=True)),
                ("account_alias", models.CharField(max_length=63, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="AWSCostEntryBill",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("billing_resource", models.CharField(default="aws", max_length=50)),
                ("bill_type", models.CharField(max_length=50)),
                ("payer_account_id", models.CharField(max_length=50)),
                ("billing_period_start", models.DateTimeField()),
                ("billing_period_end", models.DateTimeField()),
                ("finalized_datetime", models.DateTimeField(null=True)),
                ("summary_data_creation_datetime", models.DateTimeField(null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(null=True)),
                ("derived_cost_datetime", models.DateTimeField(null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("bill_type", "payer_account_id", "billing_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="AWSCostEntry",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("interval_start", models.DateTimeField()),
                ("interval_end", models.DateTimeField()),
                (
                    "bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"),
                ),
            ],
        ),
        migrations.AddIndex(
            model_name="awscostentry", index=models.Index(fields=["interval_start"], name="interval_start_idx")
        ),
        migrations.CreateModel(
            name="AWSCostEntryPricing",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("term", models.CharField(max_length=63, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
            ],
            options={"unique_together": {("term", "unit")}},
        ),
        migrations.CreateModel(
            name="AWSCostEntryProduct",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("sku", models.CharField(max_length=128, null=True)),
                ("product_name", models.TextField(null=True)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("service_code", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("memory", models.FloatField(null=True)),
                ("memory_unit", models.CharField(max_length=24, null=True)),
                ("vcpu", models.PositiveIntegerField(null=True)),
            ],
            options={"unique_together": {("sku", "product_name", "region")}},
        ),
        migrations.AddIndex(
            model_name="awscostentryproduct", index=models.Index(fields=["region"], name="region_idx")
        ),
        migrations.CreateModel(
            name="AWSCostEntryReservation",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("reservation_arn", models.TextField(unique=True)),
                ("number_of_reservations", models.PositiveIntegerField(null=True)),
                ("units_per_reservation", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("start_time", models.DateTimeField(null=True)),
                ("end_time", models.DateTimeField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name="AWSCostEntryLineItem",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("tags", django.db.models.JSONField(null=True)),
                ("invoice_id", models.CharField(max_length=63, null=True)),
                ("line_item_type", models.CharField(max_length=50)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("product_code", models.CharField(max_length=50)),
                ("usage_type", models.CharField(max_length=50, null=True)),
                ("operation", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("resource_id", models.CharField(max_length=256, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("normalization_factor", models.FloatField(null=True)),
                ("normalized_usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
                ("unblended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("reservation_amortized_upfront_fee", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                (
                    "reservation_amortized_upfront_cost_for_usage",
                    models.DecimalField(decimal_places=9, max_digits=24, null=True),
                ),
                (
                    "reservation_recurring_fee_for_usage",
                    models.DecimalField(decimal_places=9, max_digits=24, null=True),
                ),
                ("reservation_unused_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("reservation_unused_recurring_fee", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("tax_type", models.TextField(null=True)),
                (
                    "cost_entry",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntry"),
                ),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"),
                ),
                (
                    "cost_entry_pricing",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryPricing"
                    ),
                ),
                (
                    "cost_entry_product",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryProduct"
                    ),
                ),
                (
                    "cost_entry_reservation",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryReservation"
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AWSCostEntryLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("line_item_type", models.CharField(max_length=50)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("usage_type", models.CharField(max_length=50, null=True)),
                ("operation", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("resource_id", models.CharField(max_length=256, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("normalization_factor", models.FloatField(null=True)),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("currency_code", models.CharField(max_length=10)),
                ("unblended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("tax_type", models.TextField(null=True)),
                ("tags", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_pricing",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryPricing"
                    ),
                ),
                (
                    "cost_entry_product",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryProduct"
                    ),
                ),
                (
                    "cost_entry_reservation",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryReservation"
                    ),
                ),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
            ],
            options={"db_table": "reporting_awscostentrylineitem_daily"},
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdaily", index=models.Index(fields=["usage_start"], name="usage_start_idx")
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdaily",
            index=models.Index(fields=["product_code"], name="product_code_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdaily",
            index=models.Index(fields=["usage_account_id"], name="usage_account_id_idx"),
        ),
        migrations.CreateModel(
            name="AWSCostEntryLineItemDailySummary",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("normalization_factor", models.FloatField(null=True)),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("currency_code", models.CharField(max_length=10)),
                ("unblended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("tax_type", models.TextField(null=True)),
                (
                    "account_alias",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.PROTECT, to="reporting.AWSAccountAlias"
                    ),
                ),
                ("tags", django.db.models.JSONField(null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
            ],
            options={"db_table": "reporting_awscostentrylineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="summary_usage_start_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["product_code"], name="summary_product_code_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["usage_account_id"], name="summary_usage_account_id_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["tags"], name="tags_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["account_alias"], name="summary_account_alias_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["product_family"], name="summary_product_family_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["instance_type"], name="summary_instance_type_idx"),
        ),
        migrations.CreateModel(
            name="OCPUsageReportPeriod",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50)),
                ("report_period_start", models.DateTimeField()),
                ("report_period_end", models.DateTimeField()),
                ("summary_data_creation_datetime", models.DateTimeField(null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(null=True)),
                ("derived_cost_datetime", models.DateTimeField(null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("cluster_id", "report_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="OCPUsageReport",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("interval_start", models.DateTimeField()),
                ("interval_end", models.DateTimeField()),
                (
                    "report_period",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"unique_together": {("report_period", "interval_start")}},
        ),
        migrations.AddIndex(
            model_name="ocpusagereport", index=models.Index(fields=["interval_start"], name="ocp_interval_start_idx")
        ),
        migrations.CreateModel(
            name="OCPUsageLineItem",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("pod_usage_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "report",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReport"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
                ("pod_limit_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_usage_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_cores", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_bytes", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
            ],
            options={"unique_together": {("report", "namespace", "pod", "node")}},
        ),
        migrations.CreateModel(
            name="OCPUsageLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("pod_usage_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_usage_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("total_seconds", models.IntegerField(default=0)),
                ("node_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_cores", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_bytes", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("cluster_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "cluster_capacity_memory_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("total_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "total_capacity_memory_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpusagelineitem_daily"},
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdaily", index=models.Index(fields=["usage_start"], name="ocp_usage_idx")
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdaily", index=models.Index(fields=["namespace"], name="namespace_idx")
        ),
        migrations.AddIndex(model_name="ocpusagelineitemdaily", index=models.Index(fields=["pod"], name="pod_idx")),
        migrations.AddIndex(model_name="ocpusagelineitemdaily", index=models.Index(fields=["node"], name="node_idx")),
        migrations.CreateModel(
            name="OCPUsageLineItemDailySummary",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("namespace", models.CharField(max_length=253, null=True)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("node", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("pod_usage_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_usage_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_cores", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_charge_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_charge_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "node_capacity_memory_gigabyte_hours",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("node_capacity_memory_gigabytes", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("cluster_capacity_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "cluster_capacity_memory_gigabyte_hours",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("total_capacity_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "total_capacity_memory_gigabyte_hours",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("data_source", models.CharField(max_length=64, null=True)),
                ("infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("persistentvolume", models.CharField(max_length=253, null=True)),
                ("persistentvolumeclaim", models.CharField(max_length=253, null=True)),
                (
                    "persistentvolumeclaim_capacity_gigabyte",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_capacity_gigabyte_months",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_charge_gb_month",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_usage_gigabyte_months",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("project_infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("storageclass", models.CharField(max_length=50, null=True)),
                ("volume_labels", django.db.models.JSONField(null=True)),
                (
                    "volume_request_storage_gigabyte_months",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
                ("monthly_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
            ],
            options={"db_table": "reporting_ocpusagelineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="summary_ocp_usage_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["namespace"], name="summary_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary", index=models.Index(fields=["node"], name="summary_node_idx")
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="pod_labels_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["data_source"], name="summary_data_source_idx"),
        ),
        migrations.CreateModel(
            name="OCPUsagePodLabelSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_ocpusagepodlabel_summary"},
        ),
        migrations.CreateModel(
            name="AWSTagsSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_awstags_summary"},
        ),
        migrations.CreateModel(
            name="OCPAWSCostLineItemDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                (
                    "namespace",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                (
                    "pod",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("tags", django.db.models.JSONField(null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                (
                    "account_alias",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSAccountAlias"
                    ),
                ),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
                ("shared_projects", models.IntegerField(default=1)),
                ("project_costs", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
                ("markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpawscostlineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="cost_summary_ocp_usage_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["namespace"], name="cost_summary_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["node"], name="cost_summary_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["resource_id"], name="cost_summary_resource_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["tags"], name="cost_tags_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["product_family"], name="ocp_aws_product_family_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["instance_type"], name="ocp_aws_instance_type_idx"),
        ),
        migrations.CreateModel(
            name="OCPStorageLineItem",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("persistentvolumeclaim", models.CharField(max_length=253)),
                ("persistentvolume", models.CharField(max_length=253)),
                ("storageclass", models.CharField(max_length=50, null=True)),
                (
                    "persistentvolumeclaim_capacity_bytes",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_capacity_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "volume_request_storage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_usage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("persistentvolume_labels", django.db.models.JSONField(null=True)),
                ("persistentvolumeclaim_labels", django.db.models.JSONField(null=True)),
                (
                    "report",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReport"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"unique_together": {("report", "namespace", "persistentvolumeclaim")}},
        ),
        migrations.CreateModel(
            name="OCPStorageVolumeClaimLabelSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_ocpstoragevolumeclaimlabel_summary"},
        ),
        migrations.CreateModel(
            name="OCPStorageVolumeLabelSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_ocpstoragevolumelabel_summary"},
        ),
        migrations.CreateModel(
            name="OCPStorageLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("persistentvolumeclaim", models.CharField(max_length=253)),
                ("persistentvolume", models.CharField(max_length=253)),
                ("storageclass", models.CharField(max_length=50, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                (
                    "persistentvolumeclaim_capacity_bytes",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_capacity_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "volume_request_storage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_usage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("total_seconds", models.IntegerField()),
                ("persistentvolume_labels", django.db.models.JSONField(null=True)),
                ("persistentvolumeclaim_labels", django.db.models.JSONField(null=True)),
                ("node", models.CharField(max_length=253, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpstoragelineitem_daily"},
        ),
        migrations.CreateModel(
            name="CostSummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("namespace", models.CharField(max_length=253, null=True)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("node", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("pod_charge_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_charge_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "persistentvolumeclaim_charge_gb_month",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("project_infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
                ("monthly_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
            ],
            options={"db_table": "reporting_ocpcosts_summary"},
        ),
        migrations.RunSQL(
            sql="""
            UPDATE reporting_ocpawscostlineitem_daily_summary
                SET namespace='{""}',
                    pod='{""}';
            """
        ),
        migrations.CreateModel(
            name="OCPAWSCostLineItemProjectDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("pod_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                (
                    "account_alias",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSAccountAlias"
                    ),
                ),
                ("pod", models.CharField(max_length=253, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
                ("project_markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("data_source", models.CharField(max_length=64, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpawscostlineitem_project_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["usage_start"], name="cost_proj_sum_ocp_usage_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["namespace"], name="cost__proj_sum_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["node"], name="cost_proj_sum_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["resource_id"], name="cost_proj_sum_resource_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["product_family"], name="ocp_aws_proj_prod_fam_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["instance_type"], name="ocp_aws_proj_inst_type_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="cost_proj_pod_labels_idx"),
        ),
        migrations.CreateModel(
            name="AzureCostEntryBill",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("billing_period_start", models.DateTimeField()),
                ("billing_period_end", models.DateTimeField()),
                ("summary_data_creation_datetime", models.DateTimeField(null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(null=True)),
                ("finalized_datetime", models.DateTimeField(null=True)),
                ("derived_cost_datetime", models.DateTimeField(null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("billing_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="AzureMeter",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("meter_id", models.UUIDField(editable=False, unique=True)),
                ("meter_name", models.CharField(max_length=50)),
                ("meter_category", models.CharField(max_length=50, null=True)),
                ("meter_subcategory", models.CharField(max_length=50, null=True)),
                ("meter_region", models.CharField(max_length=50, null=True)),
                ("resource_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency", models.CharField(max_length=10)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
                (
                    "provider",
                    models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="api.Provider"),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AzureCostEntryProductService",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("instance_id", models.TextField(max_length=512)),
                ("resource_location", models.TextField()),
                ("consumed_service", models.TextField()),
                ("resource_type", models.TextField()),
                ("resource_group", models.TextField()),
                ("additional_info", django.db.models.JSONField(null=True)),
                ("service_tier", models.TextField()),
                ("service_name", models.TextField()),
                ("service_info1", models.TextField(null=True)),
                ("service_info2", models.TextField(null=True)),
                (
                    "provider",
                    models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="api.Provider"),
                ),
                ("instance_type", models.TextField(null=True)),
            ],
            options={"unique_together": {("instance_id", "instance_type", "service_tier", "service_name")}},
        ),
        migrations.CreateModel(
            name="AzureCostEntryLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("subscription_guid", models.CharField(max_length=50)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_date_time", models.DateTimeField()),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "cost_entry_product",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="reporting.AzureCostEntryProductService",
                    ),
                ),
                (
                    "meter",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AzureMeter"
                    ),
                ),
            ],
            options={"db_table": "reporting_azurecostentrylineitem_daily"},
        ),
        migrations.CreateModel(
            name="AzureCostEntryLineItemDailySummary",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("subscription_guid", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("service_name", models.CharField(max_length=50)),
                ("resource_location", models.CharField(max_length=50)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "meter",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AzureMeter"
                    ),
                ),
                ("currency", models.CharField(default="USD", max_length=10)),
                ("instance_count", models.IntegerField(null=True)),
                (
                    "instance_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("usage_end", models.DateTimeField(null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
            ],
            options={"db_table": "reporting_azurecostentrylineitem_daily_summary"},
        ),
        migrations.CreateModel(
            name="AzureTagsSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_azuretags_summary"},
        ),
        migrations.CreateModel(
            name="GCPCostEntryBill",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("billing_period_start", models.DateTimeField()),
                ("billing_period_end", models.DateTimeField()),
                ("summary_data_creation_datetime", models.DateTimeField(blank=True, null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(blank=True, null=True)),
                ("finalized_datetime", models.DateTimeField(blank=True, null=True)),
                ("derived_cost_datetime", models.DateTimeField(blank=True, null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("billing_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="GCPProject",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("account_id", models.CharField(max_length=20)),
                ("project_number", models.BigIntegerField()),
                ("project_id", models.CharField(max_length=256, unique=True)),
                ("project_name", models.CharField(max_length=256)),
                ("project_labels", models.CharField(blank=True, max_length=256, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="GCPCostEntryLineItemDaily",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("line_item_type", models.CharField(max_length=256)),
                ("measurement_type", models.CharField(max_length=512)),
                ("consumption", models.BigIntegerField()),
                ("unit", models.CharField(blank=True, max_length=63, null=True)),
                ("cost", models.DecimalField(blank=True, decimal_places=9, max_digits=24, null=True)),
                ("currency", models.CharField(max_length=10)),
                ("description", models.CharField(blank=True, max_length=256, null=True)),
                ("start_time", models.DateTimeField()),
                ("end_time", models.DateTimeField()),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.GCPCostEntryBill"),
                ),
                ("project", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.GCPProject")),
            ],
            options={"unique_together": {("start_time", "line_item_type", "project")}},
        ),
        migrations.CreateModel(
            name="OCPAzureCostLineItemProjectDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("data_source", models.CharField(max_length=64, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("node", models.CharField(max_length=253)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("subscription_guid", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("service_name", models.CharField(max_length=50)),
                ("resource_location", models.CharField(max_length=50)),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                ("currency", models.CharField(default="USD", max_length=10)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("pod_cost", models.DecimalField(decimal_places=6, max_digits=24, null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpazurecostlineitem_project_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["usage_start"], name="ocpazure_proj_usage_start_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["namespace"], name="ocpazure_proj_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["node"], name="ocpazure_proj_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["resource_id"], name="ocpazure_proj_resource_id_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="ocpazure_proj_pod_labels_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["service_name"], name="ocpazure_proj_service_name_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["instance_type"], name="ocpazure_proj_inst_type_idx"),
        ),
        migrations.CreateModel(
            name="OCPAzureCostLineItemDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                (
                    "namespace",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                (
                    "pod",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("subscription_guid", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("service_name", models.CharField(max_length=50)),
                ("resource_location", models.CharField(max_length=50)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                ("currency", models.CharField(default="USD", max_length=10)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
                ("shared_projects", models.IntegerField(default=1)),
                ("project_costs", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpazurecostlineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="ocpazure_usage_start_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["namespace"], name="ocpazure_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["node"], name="ocpazure_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["resource_id"], name="ocpazure_resource_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["tags"], name="ocpazure_tags_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["service_name"], name="ocpazure_service_name_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["instance_type"], name="ocpazure_instance_type_idx"),
        ),
        migrations.RunSQL(
            sql="""
            CREATE MATERIALIZED VIEW reporting_aws_cost_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start)) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start)
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary
            ON reporting_aws_cost_summary (usage_start)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_service AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    product_family,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start), product_code, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary_service
            ON reporting_aws_cost_summary_by_service (usage_start, product_code, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_account AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    usage_account_id,
                    account_alias_id,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start), usage_account_id, account_alias_id
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary_account
            ON reporting_aws_cost_summary_by_account (usage_start, usage_account_id, account_alias_id)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_region AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    region,
                    availability_zone,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start), region, availability_zone
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary_region
            ON reporting_aws_cost_summary_by_region (usage_start, region, availability_zone)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary
            ON reporting_aws_compute_summary (usage_start, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_service AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family, instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    product_family,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code, product_family, instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary_service
            ON reporting_aws_compute_summary_by_service (usage_start, product_code, product_family, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_account AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id, instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    usage_account_id,
                    account_alias_id,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), usage_account_id, account_alias_id, instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary_account
            ON reporting_aws_compute_summary_by_account (usage_start, usage_account_id, account_alias_id, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_region AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone, instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    region,
                    availability_zone,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), region, availability_zone, instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary_region
            ON reporting_aws_compute_summary_by_region (usage_start, region, availability_zone, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary
            ON reporting_aws_storage_summary (usage_start, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_service AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary_service
            ON reporting_aws_storage_summary_by_service (usage_start, product_code, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_account AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    usage_account_id,
                    account_alias_id,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), usage_account_id, account_alias_id, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary_account
            ON reporting_aws_storage_summary_by_account (usage_start, usage_account_id, account_alias_id, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_region AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    region,
                    availability_zone,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), region, availability_zone, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary_region
            ON reporting_aws_storage_summary_by_region (usage_start, region, availability_zone, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_network_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_code IN ('AmazonVPC','AmazonCloudFront','AmazonRoute53','AmazonAPIGateway')
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code
            )
            ;

            CREATE UNIQUE INDEX aws_network_summary
            ON reporting_aws_network_summary (usage_start, product_code)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_database_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_code IN ('AmazonRDS','AmazonDynamoDB','AmazonElastiCache','AmazonNeptune','AmazonRedshift','AmazonDocumentDB')
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code
            )
            ;

            CREATE UNIQUE INDEX aws_database_summary
            ON reporting_aws_database_summary (usage_start, product_code)
            ;
            """
        ),
        migrations.RunSQL(
            sql="""
            CREATE MATERIALIZED VIEW reporting_ocpallcostlineitem_daily_summary AS (
                SELECT row_number() OVER () as id,
                    lids.*
                FROM (
                    SELECT 'AWS' as source_type,
                        cluster_id,
                        cluster_alias,
                        namespace,
                        node,
                        resource_id,
                        usage_start,
                        usage_end,
                        usage_account_id,
                        account_alias_id,
                        product_code,
                        product_family,
                        instance_type,
                        region,
                        availability_zone,
                        tags,
                        usage_amount,
                        unit,
                        unblended_cost,
                        markup_cost,
                        currency_code,
                        shared_projects,
                        project_costs
                    FROM reporting_ocpawscostlineitem_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)

                    UNION

                    SELECT 'Azure' as source_type,
                        cluster_id,
                        cluster_alias,
                        namespace,
                        node,
                        resource_id,
                        usage_start,
                        usage_end,
                        subscription_guid as usage_account_id,
                        NULL::int as account_alias_id,
                        service_name as product_code,
                        NULL as product_family,
                        instance_type,
                        resource_location as region,
                        NULL as availability_zone,
                        tags,
                        usage_quantity as usage_amount,
                        unit_of_measure as unit,
                        pretax_cost as unblended_cost,
                        markup_cost,
                        currency as currency_code,
                        shared_projects,
                        project_costs
                    FROM reporting_ocpazurecostlineitem_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                ) AS lids
            )
            ;

            CREATE MATERIALIZED VIEW reporting_ocpallcostlineitem_project_daily_summary AS (
                SELECT row_number() OVER () as id,
                    lids.*
                FROM (
                    SELECT 'AWS' as source_type,
                        cluster_id,
                        cluster_alias,
                        data_source,
                        namespace,
                        node,
                        pod_labels,
                        resource_id,
                        usage_start,
                        usage_end,
                        usage_account_id,
                        account_alias_id,
                        product_code,
                        product_family,
                        instance_type,
                        region,
                        availability_zone,
                        usage_amount,
                        unit,
                        unblended_cost,
                        project_markup_cost,
                        pod_cost,
                        currency_code
                    FROM reporting_ocpawscostlineitem_project_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)

                    UNION

                    SELECT 'Azure' as source_type,
                        cluster_id,
                        cluster_alias,
                        data_source,
                        namespace,
                        node,
                        pod_labels,
                        resource_id,
                        usage_start,
                        usage_end,
                        subscription_guid as usage_account_id,
                        NULL::int as account_alias_id,
                        service_name as product_code,
                        NULL as product_family,
                        instance_type,
                        resource_location as region,
                        NULL as availability_zone,
                        usage_quantity as usage_amount,
                        unit_of_measure as unit,
                        pretax_cost as unblended_cost,
                        project_markup_cost,
                        pod_cost,
                        currency as currency_code
                    FROM reporting_ocpazurecostlineitem_project_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                ) AS lids
            )
            ;
            """
        ),
        migrations.CreateModel(
            name="AWSCostSummaryByAccount",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary_by_account", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummaryByAccount",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary_by_account", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummaryByRegion",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary_by_region", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummaryByService",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary_by_service", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSCostSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSCostSummaryByRegion",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary_by_region", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSCostSummaryByService",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary_by_service", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSDatabaseSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_database_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSNetworkSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_network_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummaryByAccount",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary_by_account", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummaryByRegion",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary_by_region", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummaryByService",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary_by_service", "managed": False},
        ),
        migrations.CreateModel(
            name="OCPAllCostLineItemDailySummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("source_type", models.TextField()),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                (
                    "namespace",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
                ("shared_projects", models.IntegerField(default=1)),
                ("project_costs", django.db.models.JSONField(null=True)),
            ],
            options={"db_table": "reporting_ocpallcostlineitem_daily_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="OCPAllCostLineItemProjectDailySummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("source_type", models.TextField()),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("data_source", models.CharField(max_length=64, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("pod_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
            ],
            options={"db_table": "reporting_ocpallcostlineitem_project_daily_summary", "managed": False},
        ),
    ]

# Generated by Django 2.2.9 on 2020-01-16 22:32
import django.contrib.postgres.fields.jsonb
import django.contrib.postgres.indexes
import django.db.models.deletion
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

    replaces = []

    initial = True

    dependencies = [
        ("api", "0001_initial_squashed_0008_auto_20190305_2015"),
        ("api", "0009_providerstatus_squashed_0042_auto_20200116_2048"),
    ]

    operations = [
        migrations.CreateModel(
            name="AWSAccountAlias",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("account_id", models.CharField(max_length=50, unique=True)),
                ("account_alias", models.CharField(max_length=63, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="AWSCostEntryBill",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("billing_resource", models.CharField(default="aws", max_length=50)),
                ("bill_type", models.CharField(max_length=50)),
                ("payer_account_id", models.CharField(max_length=50)),
                ("billing_period_start", models.DateTimeField()),
                ("billing_period_end", models.DateTimeField()),
                ("finalized_datetime", models.DateTimeField(null=True)),
                ("summary_data_creation_datetime", models.DateTimeField(null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(null=True)),
                ("derived_cost_datetime", models.DateTimeField(null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("bill_type", "payer_account_id", "billing_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="AWSCostEntry",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("interval_start", models.DateTimeField()),
                ("interval_end", models.DateTimeField()),
                (
                    "bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"),
                ),
            ],
        ),
        migrations.AddIndex(
            model_name="awscostentry", index=models.Index(fields=["interval_start"], name="interval_start_idx")
        ),
        migrations.CreateModel(
            name="AWSCostEntryPricing",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("term", models.CharField(max_length=63, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
            ],
            options={"unique_together": {("term", "unit")}},
        ),
        migrations.CreateModel(
            name="AWSCostEntryProduct",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("sku", models.CharField(max_length=128, null=True)),
                ("product_name", models.TextField(null=True)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("service_code", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("memory", models.FloatField(null=True)),
                ("memory_unit", models.CharField(max_length=24, null=True)),
                ("vcpu", models.PositiveIntegerField(null=True)),
            ],
            options={"unique_together": {("sku", "product_name", "region")}},
        ),
        migrations.AddIndex(
            model_name="awscostentryproduct", index=models.Index(fields=["region"], name="region_idx")
        ),
        migrations.CreateModel(
            name="AWSCostEntryReservation",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("reservation_arn", models.TextField(unique=True)),
                ("number_of_reservations", models.PositiveIntegerField(null=True)),
                ("units_per_reservation", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("start_time", models.DateTimeField(null=True)),
                ("end_time", models.DateTimeField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name="AWSCostEntryLineItem",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("tags", django.db.models.JSONField(null=True)),
                ("invoice_id", models.CharField(max_length=63, null=True)),
                ("line_item_type", models.CharField(max_length=50)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("product_code", models.CharField(max_length=50)),
                ("usage_type", models.CharField(max_length=50, null=True)),
                ("operation", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("resource_id", models.CharField(max_length=256, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("normalization_factor", models.FloatField(null=True)),
                ("normalized_usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
                ("unblended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("reservation_amortized_upfront_fee", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                (
                    "reservation_amortized_upfront_cost_for_usage",
                    models.DecimalField(decimal_places=9, max_digits=24, null=True),
                ),
                (
                    "reservation_recurring_fee_for_usage",
                    models.DecimalField(decimal_places=9, max_digits=24, null=True),
                ),
                ("reservation_unused_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("reservation_unused_recurring_fee", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("tax_type", models.TextField(null=True)),
                (
                    "cost_entry",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntry"),
                ),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"),
                ),
                (
                    "cost_entry_pricing",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryPricing"
                    ),
                ),
                (
                    "cost_entry_product",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryProduct"
                    ),
                ),
                (
                    "cost_entry_reservation",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryReservation"
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AWSCostEntryLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("line_item_type", models.CharField(max_length=50)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("usage_type", models.CharField(max_length=50, null=True)),
                ("operation", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("resource_id", models.CharField(max_length=256, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("normalization_factor", models.FloatField(null=True)),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("currency_code", models.CharField(max_length=10)),
                ("unblended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("tax_type", models.TextField(null=True)),
                ("tags", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_pricing",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryPricing"
                    ),
                ),
                (
                    "cost_entry_product",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryProduct"
                    ),
                ),
                (
                    "cost_entry_reservation",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSCostEntryReservation"
                    ),
                ),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
            ],
            options={"db_table": "reporting_awscostentrylineitem_daily"},
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdaily", index=models.Index(fields=["usage_start"], name="usage_start_idx")
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdaily",
            index=models.Index(fields=["product_code"], name="product_code_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdaily",
            index=models.Index(fields=["usage_account_id"], name="usage_account_id_idx"),
        ),
        migrations.CreateModel(
            name="AWSCostEntryLineItemDailySummary",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("normalization_factor", models.FloatField(null=True)),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("currency_code", models.CharField(max_length=10)),
                ("unblended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("blended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("public_on_demand_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("tax_type", models.TextField(null=True)),
                (
                    "account_alias",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.PROTECT, to="reporting.AWSAccountAlias"
                    ),
                ),
                ("tags", django.db.models.JSONField(null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
            ],
            options={"db_table": "reporting_awscostentrylineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="summary_usage_start_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["product_code"], name="summary_product_code_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["usage_account_id"], name="summary_usage_account_id_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["tags"], name="tags_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["account_alias"], name="summary_account_alias_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["product_family"], name="summary_product_family_idx"),
        ),
        migrations.AddIndex(
            model_name="awscostentrylineitemdailysummary",
            index=models.Index(fields=["instance_type"], name="summary_instance_type_idx"),
        ),
        migrations.CreateModel(
            name="OCPUsageReportPeriod",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50)),
                ("report_period_start", models.DateTimeField()),
                ("report_period_end", models.DateTimeField()),
                ("summary_data_creation_datetime", models.DateTimeField(null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(null=True)),
                ("derived_cost_datetime", models.DateTimeField(null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("cluster_id", "report_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="OCPUsageReport",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("interval_start", models.DateTimeField()),
                ("interval_end", models.DateTimeField()),
                (
                    "report_period",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"unique_together": {("report_period", "interval_start")}},
        ),
        migrations.AddIndex(
            model_name="ocpusagereport", index=models.Index(fields=["interval_start"], name="ocp_interval_start_idx")
        ),
        migrations.CreateModel(
            name="OCPUsageLineItem",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("pod_usage_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "report",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReport"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
                ("pod_limit_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_usage_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_cores", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_bytes", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
            ],
            options={"unique_together": {("report", "namespace", "pod", "node")}},
        ),
        migrations.CreateModel(
            name="OCPUsageLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("pod_usage_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_usage_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("total_seconds", models.IntegerField(default=0)),
                ("node_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_cores", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_byte_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_memory_bytes", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("cluster_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "cluster_capacity_memory_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("total_capacity_cpu_core_seconds", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "total_capacity_memory_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpusagelineitem_daily"},
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdaily", index=models.Index(fields=["usage_start"], name="ocp_usage_idx")
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdaily", index=models.Index(fields=["namespace"], name="namespace_idx")
        ),
        migrations.AddIndex(model_name="ocpusagelineitemdaily", index=models.Index(fields=["pod"], name="pod_idx")),
        migrations.AddIndex(model_name="ocpusagelineitemdaily", index=models.Index(fields=["node"], name="node_idx")),
        migrations.CreateModel(
            name="OCPUsageLineItemDailySummary",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("namespace", models.CharField(max_length=253, null=True)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("node", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("pod_usage_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_usage_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_request_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_limit_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("node_capacity_cpu_cores", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_charge_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_charge_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "node_capacity_memory_gigabyte_hours",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("node_capacity_memory_gigabytes", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("cluster_capacity_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "cluster_capacity_memory_gigabyte_hours",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("total_capacity_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "total_capacity_memory_gigabyte_hours",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("data_source", models.CharField(max_length=64, null=True)),
                ("infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("persistentvolume", models.CharField(max_length=253, null=True)),
                ("persistentvolumeclaim", models.CharField(max_length=253, null=True)),
                (
                    "persistentvolumeclaim_capacity_gigabyte",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_capacity_gigabyte_months",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_charge_gb_month",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_usage_gigabyte_months",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("project_infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("storageclass", models.CharField(max_length=50, null=True)),
                ("volume_labels", django.db.models.JSONField(null=True)),
                (
                    "volume_request_storage_gigabyte_months",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
                ("monthly_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
            ],
            options={"db_table": "reporting_ocpusagelineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="summary_ocp_usage_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["namespace"], name="summary_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary", index=models.Index(fields=["node"], name="summary_node_idx")
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="pod_labels_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["data_source"], name="summary_data_source_idx"),
        ),
        migrations.CreateModel(
            name="OCPUsagePodLabelSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_ocpusagepodlabel_summary"},
        ),
        migrations.CreateModel(
            name="AWSTagsSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_awstags_summary"},
        ),
        migrations.CreateModel(
            name="OCPAWSCostLineItemDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                (
                    "namespace",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                (
                    "pod",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("tags", django.db.models.JSONField(null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                (
                    "account_alias",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSAccountAlias"
                    ),
                ),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
                ("shared_projects", models.IntegerField(default=1)),
                ("project_costs", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
                ("markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpawscostlineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="cost_summary_ocp_usage_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["namespace"], name="cost_summary_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["node"], name="cost_summary_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["resource_id"], name="cost_summary_resource_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["tags"], name="cost_tags_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["product_family"], name="ocp_aws_product_family_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["instance_type"], name="ocp_aws_instance_type_idx"),
        ),
        migrations.CreateModel(
            name="OCPStorageLineItem",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("persistentvolumeclaim", models.CharField(max_length=253)),
                ("persistentvolume", models.CharField(max_length=253)),
                ("storageclass", models.CharField(max_length=50, null=True)),
                (
                    "persistentvolumeclaim_capacity_bytes",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_capacity_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "volume_request_storage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_usage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("persistentvolume_labels", django.db.models.JSONField(null=True)),
                ("persistentvolumeclaim_labels", django.db.models.JSONField(null=True)),
                (
                    "report",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReport"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"unique_together": {("report", "namespace", "persistentvolumeclaim")}},
        ),
        migrations.CreateModel(
            name="OCPStorageVolumeClaimLabelSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_ocpstoragevolumeclaimlabel_summary"},
        ),
        migrations.CreateModel(
            name="OCPStorageVolumeLabelSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_ocpstoragevolumelabel_summary"},
        ),
        migrations.CreateModel(
            name="OCPStorageLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("persistentvolumeclaim", models.CharField(max_length=253)),
                ("persistentvolume", models.CharField(max_length=253)),
                ("storageclass", models.CharField(max_length=50, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                (
                    "persistentvolumeclaim_capacity_bytes",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_capacity_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "volume_request_storage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                (
                    "persistentvolumeclaim_usage_byte_seconds",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("total_seconds", models.IntegerField()),
                ("persistentvolume_labels", django.db.models.JSONField(null=True)),
                ("persistentvolumeclaim_labels", django.db.models.JSONField(null=True)),
                ("node", models.CharField(max_length=253, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpstoragelineitem_daily"},
        ),
        migrations.CreateModel(
            name="CostSummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("namespace", models.CharField(max_length=253, null=True)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("node", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("pod_charge_cpu_core_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("pod_charge_memory_gigabyte_hours", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "persistentvolumeclaim_charge_gb_month",
                    models.DecimalField(decimal_places=9, max_digits=27, null=True),
                ),
                ("infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("project_infra_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=9, max_digits=27, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
                ("monthly_cost", models.DecimalField(decimal_places=15, max_digits=33, null=True)),
            ],
            options={"db_table": "reporting_ocpcosts_summary"},
        ),
        migrations.RunSQL(
            sql="""
            UPDATE reporting_ocpawscostlineitem_daily_summary
                SET namespace='{""}',
                    pod='{""}';
            """
        ),
        migrations.CreateModel(
            name="OCPAWSCostLineItemProjectDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("normalized_usage_amount", models.FloatField(null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("pod_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                (
                    "account_alias",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AWSAccountAlias"
                    ),
                ),
                ("pod", models.CharField(max_length=253, null=True)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.AWSCostEntryBill"
                    ),
                ),
                ("project_markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("data_source", models.CharField(max_length=64, null=True)),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpawscostlineitem_project_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["usage_start"], name="cost_proj_sum_ocp_usage_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["namespace"], name="cost__proj_sum_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["node"], name="cost_proj_sum_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["resource_id"], name="cost_proj_sum_resource_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["product_family"], name="ocp_aws_proj_prod_fam_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["instance_type"], name="ocp_aws_proj_inst_type_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="cost_proj_pod_labels_idx"),
        ),
        migrations.CreateModel(
            name="AzureCostEntryBill",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("billing_period_start", models.DateTimeField()),
                ("billing_period_end", models.DateTimeField()),
                ("summary_data_creation_datetime", models.DateTimeField(null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(null=True)),
                ("finalized_datetime", models.DateTimeField(null=True)),
                ("derived_cost_datetime", models.DateTimeField(null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("billing_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="AzureMeter",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("meter_id", models.UUIDField(editable=False, unique=True)),
                ("meter_name", models.CharField(max_length=50)),
                ("meter_category", models.CharField(max_length=50, null=True)),
                ("meter_subcategory", models.CharField(max_length=50, null=True)),
                ("meter_region", models.CharField(max_length=50, null=True)),
                ("resource_rate", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency", models.CharField(max_length=10)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
                (
                    "provider",
                    models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="api.Provider"),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AzureCostEntryProductService",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("instance_id", models.TextField(max_length=512)),
                ("resource_location", models.TextField()),
                ("consumed_service", models.TextField()),
                ("resource_type", models.TextField()),
                ("resource_group", models.TextField()),
                ("additional_info", django.db.models.JSONField(null=True)),
                ("service_tier", models.TextField()),
                ("service_name", models.TextField()),
                ("service_info1", models.TextField(null=True)),
                ("service_info2", models.TextField(null=True)),
                (
                    "provider",
                    models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="api.Provider"),
                ),
                ("instance_type", models.TextField(null=True)),
            ],
            options={"unique_together": {("instance_id", "instance_type", "service_tier", "service_name")}},
        ),
        migrations.CreateModel(
            name="AzureCostEntryLineItemDaily",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("subscription_guid", models.CharField(max_length=50)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_date_time", models.DateTimeField()),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "cost_entry_product",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="reporting.AzureCostEntryProductService",
                    ),
                ),
                (
                    "meter",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AzureMeter"
                    ),
                ),
            ],
            options={"db_table": "reporting_azurecostentrylineitem_daily"},
        ),
        migrations.CreateModel(
            name="AzureCostEntryLineItemDailySummary",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("subscription_guid", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("service_name", models.CharField(max_length=50)),
                ("resource_location", models.CharField(max_length=50)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "meter",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to="reporting.AzureMeter"
                    ),
                ),
                ("currency", models.CharField(default="USD", max_length=10)),
                ("instance_count", models.IntegerField(null=True)),
                (
                    "instance_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("usage_end", models.DateTimeField(null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
            ],
            options={"db_table": "reporting_azurecostentrylineitem_daily_summary"},
        ),
        migrations.CreateModel(
            name="AzureTagsSummary",
            fields=[
                ("key", models.CharField(max_length=253, primary_key=True, serialize=False)),
                (
                    "values",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
            ],
            options={"db_table": "reporting_azuretags_summary"},
        ),
        migrations.CreateModel(
            name="GCPCostEntryBill",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("billing_period_start", models.DateTimeField()),
                ("billing_period_end", models.DateTimeField()),
                ("summary_data_creation_datetime", models.DateTimeField(blank=True, null=True)),
                ("summary_data_updated_datetime", models.DateTimeField(blank=True, null=True)),
                ("finalized_datetime", models.DateTimeField(blank=True, null=True)),
                ("derived_cost_datetime", models.DateTimeField(blank=True, null=True)),
                ("provider", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Provider")),
            ],
            options={"unique_together": {("billing_period_start", "provider")}},
        ),
        migrations.CreateModel(
            name="GCPProject",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("account_id", models.CharField(max_length=20)),
                ("project_number", models.BigIntegerField()),
                ("project_id", models.CharField(max_length=256, unique=True)),
                ("project_name", models.CharField(max_length=256)),
                ("project_labels", models.CharField(blank=True, max_length=256, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="GCPCostEntryLineItemDaily",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("line_item_type", models.CharField(max_length=256)),
                ("measurement_type", models.CharField(max_length=512)),
                ("consumption", models.BigIntegerField()),
                ("unit", models.CharField(blank=True, max_length=63, null=True)),
                ("cost", models.DecimalField(blank=True, decimal_places=9, max_digits=24, null=True)),
                ("currency", models.CharField(max_length=10)),
                ("description", models.CharField(blank=True, max_length=256, null=True)),
                ("start_time", models.DateTimeField()),
                ("end_time", models.DateTimeField()),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.GCPCostEntryBill"),
                ),
                ("project", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.GCPProject")),
            ],
            options={"unique_together": {("start_time", "line_item_type", "project")}},
        ),
        migrations.CreateModel(
            name="OCPAzureCostLineItemProjectDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("data_source", models.CharField(max_length=64, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("pod", models.CharField(max_length=253, null=True)),
                ("node", models.CharField(max_length=253)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("subscription_guid", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("service_name", models.CharField(max_length=50)),
                ("resource_location", models.CharField(max_length=50)),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                ("currency", models.CharField(default="USD", max_length=10)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("pod_cost", models.DecimalField(decimal_places=6, max_digits=24, null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpazurecostlineitem_project_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["usage_start"], name="ocpazure_proj_usage_start_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["namespace"], name="ocpazure_proj_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["node"], name="ocpazure_proj_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["resource_id"], name="ocpazure_proj_resource_id_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="ocpazure_proj_pod_labels_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["service_name"], name="ocpazure_proj_service_name_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["instance_type"], name="ocpazure_proj_inst_type_idx"),
        ),
        migrations.CreateModel(
            name="OCPAzureCostLineItemDailySummary",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                (
                    "namespace",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                (
                    "pod",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("subscription_guid", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("service_name", models.CharField(max_length=50)),
                ("resource_location", models.CharField(max_length=50)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_quantity", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("pretax_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=17, null=True)),
                ("offer_id", models.PositiveIntegerField(null=True)),
                ("currency", models.CharField(default="USD", max_length=10)),
                ("unit_of_measure", models.CharField(max_length=63, null=True)),
                ("shared_projects", models.IntegerField(default=1)),
                ("project_costs", django.db.models.JSONField(null=True)),
                (
                    "cost_entry_bill",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="reporting.AzureCostEntryBill"),
                ),
                (
                    "report_period",
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.CASCADE, to="reporting.OCPUsageReportPeriod"
                    ),
                ),
            ],
            options={"db_table": "reporting_ocpazurecostlineitem_daily_summary"},
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["usage_start"], name="ocpazure_usage_start_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["namespace"], name="ocpazure_namespace_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["node"], name="ocpazure_node_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["resource_id"], name="ocpazure_resource_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["tags"], name="ocpazure_tags_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["service_name"], name="ocpazure_service_name_idx"),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["instance_type"], name="ocpazure_instance_type_idx"),
        ),
        migrations.RunSQL(
            sql="""
            CREATE MATERIALIZED VIEW reporting_aws_cost_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start)) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start)
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary
            ON reporting_aws_cost_summary (usage_start)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_service AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    product_family,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start), product_code, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary_service
            ON reporting_aws_cost_summary_by_service (usage_start, product_code, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_account AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    usage_account_id,
                    account_alias_id,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start), usage_account_id, account_alias_id
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary_account
            ON reporting_aws_cost_summary_by_account (usage_start, usage_account_id, account_alias_id)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_region AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    region,
                    availability_zone,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE date_trunc('month', usage_start) = date_trunc('month', now())
                    OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                GROUP BY date(usage_start), region, availability_zone
            )
            ;

            CREATE UNIQUE INDEX aws_cost_summary_region
            ON reporting_aws_cost_summary_by_region (usage_start, region, availability_zone)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary
            ON reporting_aws_compute_summary (usage_start, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_service AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family, instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    product_family,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code, product_family, instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary_service
            ON reporting_aws_compute_summary_by_service (usage_start, product_code, product_family, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_account AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id, instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    usage_account_id,
                    account_alias_id,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), usage_account_id, account_alias_id, instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary_account
            ON reporting_aws_compute_summary_by_account (usage_start, usage_account_id, account_alias_id, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_region AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone, instance_type) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    region,
                    availability_zone,
                    instance_type,
                    array_agg(DISTINCT resource_id) as resource_ids,
                    count(DISTINCT resource_id) as resource_count,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary,
                    unnest(resource_ids) resource_id
                -- Get data for this month or last month
                WHERE instance_type IS NOT NULL
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), region, availability_zone, instance_type
            )
            ;

            CREATE UNIQUE INDEX aws_compute_summary_region
            ON reporting_aws_compute_summary_by_region (usage_start, region, availability_zone, instance_type)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary
            ON reporting_aws_storage_summary (usage_start, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_service AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary_service
            ON reporting_aws_storage_summary_by_service (usage_start, product_code, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_account AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    usage_account_id,
                    account_alias_id,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), usage_account_id, account_alias_id, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary_account
            ON reporting_aws_storage_summary_by_account (usage_start, usage_account_id, account_alias_id, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_region AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone, product_family) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    region,
                    availability_zone,
                    product_family,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_family LIKE '%Storage%'
                    AND unit = 'GB-Mo'
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), region, availability_zone, product_family
            )
            ;

            CREATE UNIQUE INDEX aws_storage_summary_region
            ON reporting_aws_storage_summary_by_region (usage_start, region, availability_zone, product_family)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_network_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_code IN ('AmazonVPC','AmazonCloudFront','AmazonRoute53','AmazonAPIGateway')
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code
            )
            ;

            CREATE UNIQUE INDEX aws_network_summary
            ON reporting_aws_network_summary (usage_start, product_code)
            ;

            CREATE MATERIALIZED VIEW reporting_aws_database_summary AS(
                SELECT row_number() OVER(ORDER BY date(usage_start), product_code) as id,
                    date(usage_start) as usage_start,
                    date(usage_start) as usage_end,
                    product_code,
                    sum(usage_amount) as usage_amount,
                    max(unit) as unit,
                    sum(unblended_cost) as unblended_cost,
                    sum(markup_cost) as markup_cost,
                    max(currency_code) as currency_code
                FROM reporting_awscostentrylineitem_daily_summary
                -- Get data for this month or last month
                WHERE product_code IN ('AmazonRDS','AmazonDynamoDB','AmazonElastiCache','AmazonNeptune','AmazonRedshift','AmazonDocumentDB')
                    AND (
                        date_trunc('month', usage_start) = date_trunc('month', now())
                            OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                    )
                GROUP BY date(usage_start), product_code
            )
            ;

            CREATE UNIQUE INDEX aws_database_summary
            ON reporting_aws_database_summary (usage_start, product_code)
            ;
            """
        ),
        migrations.RunSQL(
            sql="""
            CREATE MATERIALIZED VIEW reporting_ocpallcostlineitem_daily_summary AS (
                SELECT row_number() OVER () as id,
                    lids.*
                FROM (
                    SELECT 'AWS' as source_type,
                        cluster_id,
                        cluster_alias,
                        namespace,
                        node,
                        resource_id,
                        usage_start,
                        usage_end,
                        usage_account_id,
                        account_alias_id,
                        product_code,
                        product_family,
                        instance_type,
                        region,
                        availability_zone,
                        tags,
                        usage_amount,
                        unit,
                        unblended_cost,
                        markup_cost,
                        currency_code,
                        shared_projects,
                        project_costs
                    FROM reporting_ocpawscostlineitem_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)

                    UNION

                    SELECT 'Azure' as source_type,
                        cluster_id,
                        cluster_alias,
                        namespace,
                        node,
                        resource_id,
                        usage_start,
                        usage_end,
                        subscription_guid as usage_account_id,
                        NULL::int as account_alias_id,
                        service_name as product_code,
                        NULL as product_family,
                        instance_type,
                        resource_location as region,
                        NULL as availability_zone,
                        tags,
                        usage_quantity as usage_amount,
                        unit_of_measure as unit,
                        pretax_cost as unblended_cost,
                        markup_cost,
                        currency as currency_code,
                        shared_projects,
                        project_costs
                    FROM reporting_ocpazurecostlineitem_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                ) AS lids
            )
            ;

            CREATE MATERIALIZED VIEW reporting_ocpallcostlineitem_project_daily_summary AS (
                SELECT row_number() OVER () as id,
                    lids.*
                FROM (
                    SELECT 'AWS' as source_type,
                        cluster_id,
                        cluster_alias,
                        data_source,
                        namespace,
                        node,
                        pod_labels,
                        resource_id,
                        usage_start,
                        usage_end,
                        usage_account_id,
                        account_alias_id,
                        product_code,
                        product_family,
                        instance_type,
                        region,
                        availability_zone,
                        usage_amount,
                        unit,
                        unblended_cost,
                        project_markup_cost,
                        pod_cost,
                        currency_code
                    FROM reporting_ocpawscostlineitem_project_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)

                    UNION

                    SELECT 'Azure' as source_type,
                        cluster_id,
                        cluster_alias,
                        data_source,
                        namespace,
                        node,
                        pod_labels,
                        resource_id,
                        usage_start,
                        usage_end,
                        subscription_guid as usage_account_id,
                        NULL::int as account_alias_id,
                        service_name as product_code,
                        NULL as product_family,
                        instance_type,
                        resource_location as region,
                        NULL as availability_zone,
                        usage_quantity as usage_amount,
                        unit_of_measure as unit,
                        pretax_cost as unblended_cost,
                        project_markup_cost,
                        pod_cost,
                        currency as currency_code
                    FROM reporting_ocpazurecostlineitem_project_daily_summary
                    WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)
                ) AS lids
            )
            ;
            """
        ),
        migrations.CreateModel(
            name="AWSCostSummaryByAccount",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary_by_account", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummaryByAccount",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary_by_account", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummaryByRegion",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary_by_region", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSComputeSummaryByService",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                (
                    "resource_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=256), null=True, size=None
                    ),
                ),
                ("resource_count", models.IntegerField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_compute_summary_by_service", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSCostSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSCostSummaryByRegion",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary_by_region", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSCostSummaryByService",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_cost_summary_by_service", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSDatabaseSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_database_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSNetworkSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_network_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummaryByAccount",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary_by_account", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummaryByRegion",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary_by_region", "managed": False},
        ),
        migrations.CreateModel(
            name="AWSStorageSummaryByService",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField(null=True)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("currency_code", models.CharField(max_length=10)),
            ],
            options={"db_table": "reporting_aws_storage_summary_by_service", "managed": False},
        ),
        migrations.CreateModel(
            name="OCPAllCostLineItemDailySummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("source_type", models.TextField()),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                (
                    "namespace",
                    django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=253), size=None),
                ),
                ("node", models.CharField(max_length=253)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("tags", django.db.models.JSONField(null=True)),
                ("usage_amount", models.DecimalField(decimal_places=9, max_digits=24, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
                ("shared_projects", models.IntegerField(default=1)),
                ("project_costs", django.db.models.JSONField(null=True)),
            ],
            options={"db_table": "reporting_ocpallcostlineitem_daily_summary", "managed": False},
        ),
        migrations.CreateModel(
            name="OCPAllCostLineItemProjectDailySummary",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("source_type", models.TextField()),
                ("cluster_id", models.CharField(max_length=50, null=True)),
                ("cluster_alias", models.CharField(max_length=256, null=True)),
                ("data_source", models.CharField(max_length=64, null=True)),
                ("namespace", models.CharField(max_length=253)),
                ("node", models.CharField(max_length=253)),
                ("pod_labels", django.db.models.JSONField(null=True)),
                ("resource_id", models.CharField(max_length=253, null=True)),
                ("usage_start", models.DateTimeField()),
                ("usage_end", models.DateTimeField()),
                ("usage_account_id", models.CharField(max_length=50)),
                ("product_code", models.CharField(max_length=50)),
                ("product_family", models.CharField(max_length=150, null=True)),
                ("instance_type", models.CharField(max_length=50, null=True)),
                ("region", models.CharField(max_length=50, null=True)),
                ("availability_zone", models.CharField(max_length=50, null=True)),
                ("usage_amount", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("unit", models.CharField(max_length=63, null=True)),
                ("unblended_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("project_markup_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("pod_cost", models.DecimalField(decimal_places=15, max_digits=30, null=True)),
                ("currency_code", models.CharField(max_length=10, null=True)),
            ],
            options={"db_table": "reporting_ocpallcostlineitem_project_daily_summary", "managed": False},
        ),
    ]
# Generated by Django 2.2.9 on 2020-01-16 22:32 UPDATE reporting_ocpawscostlineitem_daily_summary                 SET namespace='{""}',                     pod='{""}'; CREATE MATERIALIZED VIEW reporting_aws_cost_summary AS(                 SELECT row_number() OVER(ORDER BY date(usage_start)) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE date_trunc('month', usage_start) = date_trunc('month', now())                     OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                 GROUP BY date(usage_start)             )             ;              CREATE UNIQUE INDEX aws_cost_summary             ON reporting_aws_cost_summary (usage_start)             ;              CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_service AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     product_code,                     product_family,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE date_trunc('month', usage_start) = date_trunc('month', now())                     OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                 GROUP BY date(usage_start), product_code, product_family             )             ;              CREATE UNIQUE INDEX aws_cost_summary_service             ON reporting_aws_cost_summary_by_service (usage_start, product_code, product_family)             ;              CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_account AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     usage_account_id,                     account_alias_id,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE date_trunc('month', usage_start) = date_trunc('month', now())                     OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                 GROUP BY date(usage_start), usage_account_id, account_alias_id             )             ;              CREATE UNIQUE INDEX aws_cost_summary_account             ON reporting_aws_cost_summary_by_account (usage_start, usage_account_id, account_alias_id)             ;              CREATE MATERIALIZED VIEW reporting_aws_cost_summary_by_region AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     region,                     availability_zone,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE date_trunc('month', usage_start) = date_trunc('month', now())                     OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                 GROUP BY date(usage_start), region, availability_zone             )             ;              CREATE UNIQUE INDEX aws_cost_summary_region             ON reporting_aws_cost_summary_by_region (usage_start, region, availability_zone)             ;              CREATE MATERIALIZED VIEW reporting_aws_compute_summary AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), instance_type) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     instance_type,                     array_agg(DISTINCT resource_id) as resource_ids,                     count(DISTINCT resource_id) as resource_count,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary,                     unnest(resource_ids) resource_id                 -- Get data for this month or last month                 WHERE instance_type IS NOT NULL                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), instance_type             )             ;              CREATE UNIQUE INDEX aws_compute_summary             ON reporting_aws_compute_summary (usage_start, instance_type)             ;              CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_service AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family, instance_type) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     product_code,                     product_family,                     instance_type,                     array_agg(DISTINCT resource_id) as resource_ids,                     count(DISTINCT resource_id) as resource_count,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary,                     unnest(resource_ids) resource_id                 -- Get data for this month or last month                 WHERE instance_type IS NOT NULL                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), product_code, product_family, instance_type             )             ;              CREATE UNIQUE INDEX aws_compute_summary_service             ON reporting_aws_compute_summary_by_service (usage_start, product_code, product_family, instance_type)             ;              CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_account AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id, instance_type) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     usage_account_id,                     account_alias_id,                     instance_type,                     array_agg(DISTINCT resource_id) as resource_ids,                     count(DISTINCT resource_id) as resource_count,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary,                     unnest(resource_ids) resource_id                 -- Get data for this month or last month                 WHERE instance_type IS NOT NULL                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), usage_account_id, account_alias_id, instance_type             )             ;              CREATE UNIQUE INDEX aws_compute_summary_account             ON reporting_aws_compute_summary_by_account (usage_start, usage_account_id, account_alias_id, instance_type)             ;              CREATE MATERIALIZED VIEW reporting_aws_compute_summary_by_region AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone, instance_type) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     region,                     availability_zone,                     instance_type,                     array_agg(DISTINCT resource_id) as resource_ids,                     count(DISTINCT resource_id) as resource_count,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary,                     unnest(resource_ids) resource_id                 -- Get data for this month or last month                 WHERE instance_type IS NOT NULL                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), region, availability_zone, instance_type             )             ;              CREATE UNIQUE INDEX aws_compute_summary_region             ON reporting_aws_compute_summary_by_region (usage_start, region, availability_zone, instance_type)             ;              CREATE MATERIALIZED VIEW reporting_aws_storage_summary AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), product_family) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     product_family,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE product_family LIKE '%Storage%'                     AND unit = 'GB-Mo'                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), product_family             )             ;              CREATE UNIQUE INDEX aws_storage_summary             ON reporting_aws_storage_summary (usage_start, product_family)             ;              CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_service AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), product_code, product_family) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     product_code,                     product_family,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE product_family LIKE '%Storage%'                     AND unit = 'GB-Mo'                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), product_code, product_family             )             ;              CREATE UNIQUE INDEX aws_storage_summary_service             ON reporting_aws_storage_summary_by_service (usage_start, product_code, product_family)             ;              CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_account AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), usage_account_id, account_alias_id, product_family) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     usage_account_id,                     account_alias_id,                     product_family,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE product_family LIKE '%Storage%'                     AND unit = 'GB-Mo'                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), usage_account_id, account_alias_id, product_family             )             ;              CREATE UNIQUE INDEX aws_storage_summary_account             ON reporting_aws_storage_summary_by_account (usage_start, usage_account_id, account_alias_id, product_family)             ;              CREATE MATERIALIZED VIEW reporting_aws_storage_summary_by_region AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), region, availability_zone, product_family) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     region,                     availability_zone,                     product_family,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE product_family LIKE '%Storage%'                     AND unit = 'GB-Mo'                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), region, availability_zone, product_family             )             ;              CREATE UNIQUE INDEX aws_storage_summary_region             ON reporting_aws_storage_summary_by_region (usage_start, region, availability_zone, product_family)             ;              CREATE MATERIALIZED VIEW reporting_aws_network_summary AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), product_code) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     product_code,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE product_code IN ('AmazonVPC','AmazonCloudFront','AmazonRoute53','AmazonAPIGateway')                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), product_code             )             ;              CREATE UNIQUE INDEX aws_network_summary             ON reporting_aws_network_summary (usage_start, product_code)             ;              CREATE MATERIALIZED VIEW reporting_aws_database_summary AS(                 SELECT row_number() OVER(ORDER BY date(usage_start), product_code) as id,                     date(usage_start) as usage_start,                     date(usage_start) as usage_end,                     product_code,                     sum(usage_amount) as usage_amount,                     max(unit) as unit,                     sum(unblended_cost) as unblended_cost,                     sum(markup_cost) as markup_cost,                     max(currency_code) as currency_code                 FROM reporting_awscostentrylineitem_daily_summary                 -- Get data for this month or last month                 WHERE product_code IN ('AmazonRDS','AmazonDynamoDB','AmazonElastiCache','AmazonNeptune','AmazonRedshift','AmazonDocumentDB')                     AND (                         date_trunc('month', usage_start) = date_trunc('month', now())                             OR date_trunc('month', usage_start) = date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                     )                 GROUP BY date(usage_start), product_code             )             ;              CREATE UNIQUE INDEX aws_database_summary             ON reporting_aws_database_summary (usage_start, product_code)             ; CREATE MATERIALIZED VIEW reporting_ocpallcostlineitem_daily_summary AS (                 SELECT row_number() OVER () as id,                     lids.*                 FROM (                     SELECT 'AWS' as source_type,                         cluster_id,                         cluster_alias,                         namespace,                         node,                         resource_id,                         usage_start,                         usage_end,                         usage_account_id,                         account_alias_id,                         product_code,                         product_family,                         instance_type,                         region,                         availability_zone,                         tags,                         usage_amount,                         unit,                         unblended_cost,                         markup_cost,                         currency_code,                         shared_projects,                         project_costs                     FROM reporting_ocpawscostlineitem_daily_summary                     WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                      UNION                      SELECT 'Azure' as source_type,                         cluster_id,                         cluster_alias,                         namespace,                         node,                         resource_id,                         usage_start,                         usage_end,                         subscription_guid as usage_account_id,                         NULL::int as account_alias_id,                         service_name as product_code,                         NULL as product_family,                         instance_type,                         resource_location as region,                         NULL as availability_zone,                         tags,                         usage_quantity as usage_amount,                         unit_of_measure as unit,                         pretax_cost as unblended_cost,                         markup_cost,                         currency as currency_code,                         shared_projects,                         project_costs                     FROM reporting_ocpazurecostlineitem_daily_summary                     WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                 ) AS lids             )             ;              CREATE MATERIALIZED VIEW reporting_ocpallcostlineitem_project_daily_summary AS (                 SELECT row_number() OVER () as id,                     lids.*                 FROM (                     SELECT 'AWS' as source_type,                         cluster_id,                         cluster_alias,                         data_source,                         namespace,                         node,                         pod_labels,                         resource_id,                         usage_start,                         usage_end,                         usage_account_id,                         account_alias_id,                         product_code,                         product_family,                         instance_type,                         region,                         availability_zone,                         usage_amount,                         unit,                         unblended_cost,                         project_markup_cost,                         pod_cost,                         currency_code                     FROM reporting_ocpawscostlineitem_project_daily_summary                     WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                      UNION                      SELECT 'Azure' as source_type,                         cluster_id,                         cluster_alias,                         data_source,                         namespace,                         node,                         pod_labels,                         resource_id,                         usage_start,                         usage_end,                         subscription_guid as usage_account_id,                         NULL::int as account_alias_id,                         service_name as product_code,                         NULL as product_family,                         instance_type,                         resource_location as region,                         NULL as availability_zone,                         usage_quantity as usage_amount,                         unit_of_measure as unit,                         pretax_cost as unblended_cost,                         project_markup_cost,                         pod_cost,                         currency as currency_code                     FROM reporting_ocpazurecostlineitem_project_daily_summary                     WHERE usage_start >= date_trunc('month', date_trunc('month', now()) - INTERVAL '1' DAY)                 ) AS lids             )             ;