# Generated by Django 2.2.10 on 2020-02-18 12:51
import django.contrib.postgres.indexes
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

    dependencies = [("reporting", "0098_auto_20200221_2034")]

    operations = [
        migrations.RunSQL(
            """
drop materialized view if exists reporting_ocpallcostlineitem_daily_summary;
drop materialized view if exists reporting_ocpallcostlineitem_project_daily_summary;
            """
        ),
        migrations.RemoveIndex(model_name="ocpawscostlineitemdailysummary", name="cost_summary_node_idx"),
        migrations.RemoveIndex(
            model_name="ocpawscostlineitemprojectdailysummary", name="cost__proj_sum_namespace_idx"
        ),
        migrations.RemoveIndex(model_name="ocpawscostlineitemprojectdailysummary", name="cost_proj_sum_node_idx"),
        migrations.RemoveIndex(model_name="ocpazurecostlineitemdailysummary", name="ocpazure_node_idx"),
        migrations.RemoveIndex(
            model_name="ocpazurecostlineitemprojectdailysummary", name="ocpazure_proj_namespace_idx"
        ),
        migrations.RemoveIndex(model_name="ocpazurecostlineitemprojectdailysummary", name="ocpazure_proj_node_idx"),
        migrations.RemoveIndex(model_name="ocpusagelineitemdaily", name="namespace_idx"),
        migrations.RemoveIndex(model_name="ocpusagelineitemdaily", name="node_idx"),
        migrations.RemoveIndex(model_name="ocpusagelineitemdailysummary", name="summary_namespace_idx"),
        migrations.RemoveIndex(model_name="ocpusagelineitemdailysummary", name="summary_node_idx"),
        migrations.AlterField(
            model_name="ocpawscostlineitemprojectdailysummary", name="usage_end", field=models.DateField()
        ),
        migrations.AlterField(
            model_name="ocpawscostlineitemprojectdailysummary", name="usage_start", field=models.DateField()
        ),
        migrations.AlterField(
            model_name="ocpazurecostlineitemdailysummary", name="usage_end", field=models.DateField()
        ),
        migrations.AlterField(
            model_name="ocpazurecostlineitemdailysummary", name="usage_start", field=models.DateField()
        ),
        migrations.AlterField(
            model_name="ocpazurecostlineitemprojectdailysummary", name="usage_end", field=models.DateField()
        ),
        migrations.AlterField(
            model_name="ocpazurecostlineitemprojectdailysummary", name="usage_start", field=models.DateField()
        ),
        migrations.AlterField(model_name="ocpstoragelineitemdaily", name="usage_end", field=models.DateField()),
        migrations.AlterField(model_name="ocpstoragelineitemdaily", name="usage_start", field=models.DateField()),
        migrations.AlterField(model_name="ocpusagelineitemdaily", name="total_seconds", field=models.IntegerField()),
        migrations.AlterField(model_name="ocpusagelineitemdaily", name="usage_end", field=models.DateField()),
        migrations.AlterField(model_name="ocpusagelineitemdaily", name="usage_start", field=models.DateField()),
        migrations.AlterField(model_name="ocpusagelineitemdailysummary", name="usage_end", field=models.DateField()),
        migrations.AlterField(model_name="ocpusagelineitemdailysummary", name="usage_start", field=models.DateField()),
        migrations.AddIndex(
            model_name="ocpawscostlineitemdailysummary",
            index=models.Index(fields=["node"], name="cost_summary_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(
                fields=["namespace"], name="cost__proj_sum_namespace_idx", opclasses=["varchar_pattern_ops"]
            ),
        ),
        migrations.AddIndex(
            model_name="ocpawscostlineitemprojectdailysummary",
            index=models.Index(fields=["node"], name="cost_proj_sum_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemdailysummary",
            index=models.Index(fields=["node"], name="ocpazure_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(
                fields=["namespace"], name="ocpazure_proj_namespace_idx", opclasses=["varchar_pattern_ops"]
            ),
        ),
        migrations.AddIndex(
            model_name="ocpazurecostlineitemprojectdailysummary",
            index=models.Index(fields=["node"], name="ocpazure_proj_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpstoragelineitemdaily",
            index=models.Index(
                fields=["namespace"], name="ocp_storage_li_namespace_idx", opclasses=["varchar_pattern_ops"]
            ),
        ),
        migrations.AddIndex(
            model_name="ocpstoragelineitemdaily",
            index=models.Index(fields=["node"], name="ocp_storage_li_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdaily",
            index=models.Index(fields=["namespace"], name="namespace_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdaily",
            index=models.Index(fields=["node"], name="node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["namespace"], name="summary_namespace_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="ocpusagelineitemdailysummary",
            index=models.Index(fields=["node"], name="summary_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AlterField(model_name="costsummary", name="usage_end", field=models.DateField()),
        migrations.AlterField(model_name="costsummary", name="usage_start", field=models.DateField()),
        migrations.AddIndex(
            model_name="costsummary", index=models.Index(fields=["usage_start"], name="ocpcostsum_usage_start_idx")
        ),
        migrations.AddIndex(
            model_name="costsummary",
            index=models.Index(
                fields=["namespace"], name="ocpcostsum_namespace_idx", opclasses=["varchar_pattern_ops"]
            ),
        ),
        migrations.AddIndex(
            model_name="costsummary",
            index=models.Index(fields=["node"], name="ocpcostsum_node_idx", opclasses=["varchar_pattern_ops"]),
        ),
        migrations.AddIndex(
            model_name="costsummary",
            index=django.contrib.postgres.indexes.GinIndex(fields=["pod_labels"], name="ocpcostsum_pod_labels_idx"),
        ),
        # This extension will help specifically with "col LIKE %val%"
        # operations. (As long as val is at least 3 characters)
        migrations.RunSQL(
            """
create extension if not exists pg_trgm schema public;
            """
        ),
        # Create indexes to aid with text searching.
        # These cases will specifically help with case-insensitive
        # and contains (vs startswith) searches
        # ocp usage line item daily
        migrations.RunSQL(
            """
/* add namespace index for like trigram ops */
create index if not exists ocp_namespace_idx
    on  reporting_ocpusagelineitem_daily using gin (UPPER(namespace) gin_trgm_ops);

/* add node index for like trigram ops */
create index if not exists ocp_node_idx
    on reporting_ocpusagelineitem_daily using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # ocp usage line item daily summary
        migrations.RunSQL(
            """
/* add namespace index for like trigram ops */
create index if not exists ocp_summary_namespace_like_idx
    on reporting_ocpusagelineitem_daily_summary using gin (UPPER(namespace) gin_trgm_ops);

/* add node index for like trigram ops */
create index if not exists ocp_summary_node_like_idx
    on reporting_ocpusagelineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # reporting_ocpstoragelineitem_daily
        migrations.RunSQL(
            """
/* add namespace index for like trigram ops */
create index if not exists ocp_storage_li_namespace_like_idx
    on reporting_ocpstoragelineitem_daily using gin (UPPER(namespace) gin_trgm_ops);

/* add node index for like trigram ops */
create index if not exists ocp_storage_li_node_like_idx
    on reporting_ocpstoragelineitem_daily using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # ocp azure cost
        migrations.RunSQL(
            """
/* add node index for like trigram ops */
create index if not exists ocpazure_node_like_idx
    on reporting_ocpazurecostlineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # ocp azure project cost
        migrations.RunSQL(
            """
/* add namespace index for like trigram ops */
create index if not exists ocpazure_proj_namespace_like_idx
    on reporting_ocpazurecostlineitem_project_daily_summary using gin (UPPER(namespace) gin_trgm_ops);

/* add node index for like trigram ops */
create index if not exists ocpazure_proj_node_like_idx
    on reporting_ocpazurecostlineitem_project_daily_summary using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # reporting_ocpawscostlineitem_daily_summary
        migrations.RunSQL(
            """
/* add node index for like trigram ops */
create index if not exists cost_summary_node_like_idx
    on reporting_ocpawscostlineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # reporting_ocpawscostlineitem_project_daily_summary
        migrations.RunSQL(
            """
/* add namespace index for like trigram ops */
create index if not exists cost__proj_sum_namespace_like_idx
    on reporting_ocpawscostlineitem_project_daily_summary using gin (UPPER(namespace) gin_trgm_ops);

/* add node index for like trigram ops */
create index if not exists cost__proj_sum_node_like_idx
    on reporting_ocpawscostlineitem_project_daily_summary using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        # reporting_ocpcosts_summary
        migrations.RunSQL(
            """
/* add namespace index for like trigram ops */
create index if not exists ocpcostsum_namespace_like_idx
    on reporting_ocpcosts_summary using gin (UPPER(namespace) gin_trgm_ops);

/* add node index for like trigram ops */
create index if not exists ocpcostsum_node_like_idx
    on reporting_ocpcosts_summary using gin (UPPER(node) gin_trgm_ops);
            """
        ),
        migrations.RunSQL(
            """
drop materialized view if exists reporting_ocpallcostlineitem_daily_summary;

create materialized view if not exists reporting_ocpallcostlineitem_daily_summary as
 SELECT row_number() OVER () AS id,
    lids.source_type,
    lids.cluster_id,
    lids.cluster_alias,
    lids.namespace,
    lids.node,
    lids.resource_id,
    lids.usage_start,
    lids.usage_end,
    lids.usage_account_id,
    lids.account_alias_id,
    lids.product_code,
    lids.product_family,
    lids.instance_type,
    lids.region,
    lids.availability_zone,
    lids.tags,
    lids.usage_amount,
    lids.unit,
    lids.unblended_cost,
    lids.markup_cost,
    lids.currency_code,
    lids.shared_projects,
    lids.project_costs
   FROM ( SELECT 'AWS'::text AS source_type,
            reporting_ocpawscostlineitem_daily_summary.cluster_id,
            reporting_ocpawscostlineitem_daily_summary.cluster_alias,
            reporting_ocpawscostlineitem_daily_summary.namespace,
            reporting_ocpawscostlineitem_daily_summary.node,
            reporting_ocpawscostlineitem_daily_summary.resource_id,
            reporting_ocpawscostlineitem_daily_summary.usage_start::date,
            reporting_ocpawscostlineitem_daily_summary.usage_end::date,
            reporting_ocpawscostlineitem_daily_summary.usage_account_id,
            reporting_ocpawscostlineitem_daily_summary.account_alias_id,
            reporting_ocpawscostlineitem_daily_summary.product_code,
            reporting_ocpawscostlineitem_daily_summary.product_family,
            reporting_ocpawscostlineitem_daily_summary.instance_type,
            reporting_ocpawscostlineitem_daily_summary.region,
            reporting_ocpawscostlineitem_daily_summary.availability_zone,
            reporting_ocpawscostlineitem_daily_summary.tags,
            reporting_ocpawscostlineitem_daily_summary.usage_amount,
            reporting_ocpawscostlineitem_daily_summary.unit,
            reporting_ocpawscostlineitem_daily_summary.unblended_cost,
            reporting_ocpawscostlineitem_daily_summary.markup_cost,
            reporting_ocpawscostlineitem_daily_summary.currency_code,
            reporting_ocpawscostlineitem_daily_summary.shared_projects,
            reporting_ocpawscostlineitem_daily_summary.project_costs
           FROM reporting_ocpawscostlineitem_daily_summary
          WHERE reporting_ocpawscostlineitem_daily_summary.usage_start >= date_trunc('month'::text, date_trunc('month'::text, now()) - '1 day'::interval day)
        UNION
         SELECT 'Azure'::text AS source_type,
            reporting_ocpazurecostlineitem_daily_summary.cluster_id,
            reporting_ocpazurecostlineitem_daily_summary.cluster_alias,
            reporting_ocpazurecostlineitem_daily_summary.namespace,
            reporting_ocpazurecostlineitem_daily_summary.node,
            reporting_ocpazurecostlineitem_daily_summary.resource_id,
            reporting_ocpazurecostlineitem_daily_summary.usage_start::date,
            reporting_ocpazurecostlineitem_daily_summary.usage_end::date,
            reporting_ocpazurecostlineitem_daily_summary.subscription_guid AS usage_account_id,
            NULL::integer AS account_alias_id,
            reporting_ocpazurecostlineitem_daily_summary.service_name AS product_code,
            NULL::character varying AS product_family,
            reporting_ocpazurecostlineitem_daily_summary.instance_type,
            reporting_ocpazurecostlineitem_daily_summary.resource_location AS region,
            NULL::character varying AS availability_zone,
            reporting_ocpazurecostlineitem_daily_summary.tags,
            reporting_ocpazurecostlineitem_daily_summary.usage_quantity AS usage_amount,
            reporting_ocpazurecostlineitem_daily_summary.unit_of_measure AS unit,
            reporting_ocpazurecostlineitem_daily_summary.pretax_cost AS unblended_cost,
            reporting_ocpazurecostlineitem_daily_summary.markup_cost,
            reporting_ocpazurecostlineitem_daily_summary.currency AS currency_code,
            reporting_ocpazurecostlineitem_daily_summary.shared_projects,
            reporting_ocpazurecostlineitem_daily_summary.project_costs
           FROM reporting_ocpazurecostlineitem_daily_summary
          WHERE reporting_ocpazurecostlineitem_daily_summary.usage_start >= date_trunc('month'::text, date_trunc('month'::text, now()) - '1 day'::interval day)) lids
          with no data;

create index mv_reporting_ocpallcostlineitem_daily_summary_namespace_ix
    on reporting_ocpallcostlineitem_daily_summary using gin (namespace);
create index mv_reporting_ocpallcostlineitem_daily_summary_node_ix
    on reporting_ocpallcostlineitem_daily_summary (node varchar_pattern_ops);
create index mv_reporting_ocpallcostlineitem_daily_summary_usage_ix
    on reporting_ocpallcostlineitem_daily_summary (usage_start);


drop materialized view if exists reporting_ocpallcostlineitem_project_daily_summary;

create materialized view if not exists reporting_ocpallcostlineitem_project_daily_summary as
 SELECT row_number() OVER () AS id,
    lids.source_type,
    lids.cluster_id,
    lids.cluster_alias,
    lids.data_source,
    lids.namespace,
    lids.node,
    lids.pod_labels,
    lids.resource_id,
    lids.usage_start,
    lids.usage_end,
    lids.usage_account_id,
    lids.account_alias_id,
    lids.product_code,
    lids.product_family,
    lids.instance_type,
    lids.region,
    lids.availability_zone,
    lids.usage_amount,
    lids.unit,
    lids.unblended_cost,
    lids.project_markup_cost,
    lids.pod_cost,
    lids.currency_code
   FROM ( SELECT 'AWS'::text AS source_type,
            reporting_ocpawscostlineitem_project_daily_summary.cluster_id,
            reporting_ocpawscostlineitem_project_daily_summary.cluster_alias,
            reporting_ocpawscostlineitem_project_daily_summary.data_source,
            reporting_ocpawscostlineitem_project_daily_summary.namespace,
            reporting_ocpawscostlineitem_project_daily_summary.node,
            reporting_ocpawscostlineitem_project_daily_summary.pod_labels,
            reporting_ocpawscostlineitem_project_daily_summary.resource_id,
            reporting_ocpawscostlineitem_project_daily_summary.usage_start::date,
            reporting_ocpawscostlineitem_project_daily_summary.usage_end::date,
            reporting_ocpawscostlineitem_project_daily_summary.usage_account_id,
            reporting_ocpawscostlineitem_project_daily_summary.account_alias_id,
            reporting_ocpawscostlineitem_project_daily_summary.product_code,
            reporting_ocpawscostlineitem_project_daily_summary.product_family,
            reporting_ocpawscostlineitem_project_daily_summary.instance_type,
            reporting_ocpawscostlineitem_project_daily_summary.region,
            reporting_ocpawscostlineitem_project_daily_summary.availability_zone,
            reporting_ocpawscostlineitem_project_daily_summary.usage_amount,
            reporting_ocpawscostlineitem_project_daily_summary.unit,
            reporting_ocpawscostlineitem_project_daily_summary.unblended_cost,
            reporting_ocpawscostlineitem_project_daily_summary.project_markup_cost,
            reporting_ocpawscostlineitem_project_daily_summary.pod_cost,
            reporting_ocpawscostlineitem_project_daily_summary.currency_code
           FROM reporting_ocpawscostlineitem_project_daily_summary
          WHERE reporting_ocpawscostlineitem_project_daily_summary.usage_start >= date_trunc('month'::text, date_trunc('month'::text, now()) - '1 day'::interval day)
        UNION
         SELECT 'Azure'::text AS source_type,
            reporting_ocpazurecostlineitem_project_daily_summary.cluster_id,
            reporting_ocpazurecostlineitem_project_daily_summary.cluster_alias,
            reporting_ocpazurecostlineitem_project_daily_summary.data_source,
            reporting_ocpazurecostlineitem_project_daily_summary.namespace,
            reporting_ocpazurecostlineitem_project_daily_summary.node,
            reporting_ocpazurecostlineitem_project_daily_summary.pod_labels,
            reporting_ocpazurecostlineitem_project_daily_summary.resource_id,
            reporting_ocpazurecostlineitem_project_daily_summary.usage_start::date,
            reporting_ocpazurecostlineitem_project_daily_summary.usage_end::date,
            reporting_ocpazurecostlineitem_project_daily_summary.subscription_guid AS usage_account_id,
            NULL::integer AS account_alias_id,
            reporting_ocpazurecostlineitem_project_daily_summary.service_name AS product_code,
            NULL::character varying AS product_family,
            reporting_ocpazurecostlineitem_project_daily_summary.instance_type,
            reporting_ocpazurecostlineitem_project_daily_summary.resource_location AS region,
            NULL::character varying AS availability_zone,
            reporting_ocpazurecostlineitem_project_daily_summary.usage_quantity AS usage_amount,
            reporting_ocpazurecostlineitem_project_daily_summary.unit_of_measure AS unit,
            reporting_ocpazurecostlineitem_project_daily_summary.pretax_cost AS unblended_cost,
            reporting_ocpazurecostlineitem_project_daily_summary.project_markup_cost,
            reporting_ocpazurecostlineitem_project_daily_summary.pod_cost,
            reporting_ocpazurecostlineitem_project_daily_summary.currency AS currency_code
           FROM reporting_ocpazurecostlineitem_project_daily_summary
          WHERE reporting_ocpazurecostlineitem_project_daily_summary.usage_start >= date_trunc('month'::text, date_trunc('month'::text, now()) - '1 day'::interval day)) lids
          with no data;

create index mv_reporting_ocpallcostlineitem_prj_daily_summary_namespace_ix
    on reporting_ocpallcostlineitem_project_daily_summary (namespace varchar_pattern_ops);
create index mv_reporting_ocpallcostlineitem_prj_daily_summary_node_ix
    on reporting_ocpallcostlineitem_project_daily_summary (node varchar_pattern_ops);
create index mv_reporting_ocpallcostlineitem_prj_daily_summary_namespace_like_ix
    on reporting_ocpallcostlineitem_project_daily_summary using gin (namespace gin_trgm_ops);
create index mv_reporting_ocpallcostlineitem_prj_daily_summary_node_like_ix
    on reporting_ocpallcostlineitem_project_daily_summary using gin (node gin_trgm_ops);
create index mv_reporting_ocpallcostlineitem_prj_daily_summary_usage_ix
    on reporting_ocpallcostlineitem_project_daily_summary (usage_start);
            """
        ),
        migrations.RunSQL(
            """
refresh materialized view reporting_ocpallcostlineitem_daily_summary;
refresh materialized view reporting_ocpallcostlineitem_project_daily_summary;
            """
        ),
    ]

[((282, 492), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\ndrop materialized view if exists reporting_ocpallcostlineitem_daily_summary;\ndrop materialized view if exists reporting_ocpallcostlineitem_project_daily_summary;\n            """'], {}), '(\n    """\ndrop materialized view if exists reporting_ocpallcostlineitem_daily_summary;\ndrop materialized view if exists reporting_ocpallcostlineitem_project_daily_summary;\n            """\n    )\n', (299, 492), False, 'from django.db import migrations\n'), ((514, 616), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpawscostlineitemdailysummary"""', 'name': '"""cost_summary_node_idx"""'}), "(model_name='ocpawscostlineitemdailysummary', name=\n    'cost_summary_node_idx')\n", (536, 616), False, 'from django.db import migrations\n'), ((621, 736), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpawscostlineitemprojectdailysummary"""', 'name': '"""cost__proj_sum_namespace_idx"""'}), "(model_name='ocpawscostlineitemprojectdailysummary',\n    name='cost__proj_sum_namespace_idx')\n", (643, 736), False, 'from django.db import migrations\n'), ((764, 873), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpawscostlineitemprojectdailysummary"""', 'name': '"""cost_proj_sum_node_idx"""'}), "(model_name='ocpawscostlineitemprojectdailysummary',\n    name='cost_proj_sum_node_idx')\n", (786, 873), False, 'from django.db import migrations\n'), ((879, 979), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpazurecostlineitemdailysummary"""', 'name': '"""ocpazure_node_idx"""'}), "(model_name='ocpazurecostlineitemdailysummary', name=\n    'ocpazure_node_idx')\n", (901, 979), False, 'from django.db import migrations\n'), ((984, 1100), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpazurecostlineitemprojectdailysummary"""', 'name': '"""ocpazure_proj_namespace_idx"""'}), "(model_name='ocpazurecostlineitemprojectdailysummary',\n    name='ocpazure_proj_namespace_idx')\n", (1006, 1100), False, 'from django.db import migrations\n'), ((1128, 1239), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpazurecostlineitemprojectdailysummary"""', 'name': '"""ocpazure_proj_node_idx"""'}), "(model_name='ocpazurecostlineitemprojectdailysummary',\n    name='ocpazure_proj_node_idx')\n", (1150, 1239), False, 'from django.db import migrations\n'), ((1245, 1330), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdaily"""', 'name': '"""namespace_idx"""'}), "(model_name='ocpusagelineitemdaily', name='namespace_idx'\n    )\n", (1267, 1330), False, 'from django.db import migrations\n'), ((1335, 1410), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdaily"""', 'name': '"""node_idx"""'}), "(model_name='ocpusagelineitemdaily', name='node_idx')\n", (1357, 1410), False, 'from django.db import migrations\n'), ((1420, 1520), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdailysummary"""', 'name': '"""summary_namespace_idx"""'}), "(model_name='ocpusagelineitemdailysummary', name=\n    'summary_namespace_idx')\n", (1442, 1520), False, 'from django.db import migrations\n'), ((1525, 1620), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdailysummary"""', 'name': '"""summary_node_idx"""'}), "(model_name='ocpusagelineitemdailysummary', name=\n    'summary_node_idx')\n", (1547, 1620), False, 'from django.db import migrations\n'), ((7075, 7172), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\ncreate extension if not exists pg_trgm schema public;\n            """'], {}), '(\n    """\ncreate extension if not exists pg_trgm schema public;\n            """)\n', (7092, 7172), False, 'from django.db import migrations\n'), ((7403, 7788), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add namespace index for like trigram ops */\ncreate index if not exists ocp_namespace_idx\n    on  reporting_ocpusagelineitem_daily using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocp_node_idx\n    on reporting_ocpusagelineitem_daily using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add namespace index for like trigram ops */\ncreate index if not exists ocp_namespace_idx\n    on  reporting_ocpusagelineitem_daily using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocp_node_idx\n    on reporting_ocpusagelineitem_daily using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (7420, 7788), False, 'from django.db import migrations\n'), ((7854, 8280), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add namespace index for like trigram ops */\ncreate index if not exists ocp_summary_namespace_like_idx\n    on reporting_ocpusagelineitem_daily_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocp_summary_node_like_idx\n    on reporting_ocpusagelineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add namespace index for like trigram ops */\ncreate index if not exists ocp_summary_namespace_like_idx\n    on reporting_ocpusagelineitem_daily_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocp_summary_node_like_idx\n    on reporting_ocpusagelineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (7871, 8280), False, 'from django.db import migrations\n'), ((8347, 8767), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add namespace index for like trigram ops */\ncreate index if not exists ocp_storage_li_namespace_like_idx\n    on reporting_ocpstoragelineitem_daily using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocp_storage_li_node_like_idx\n    on reporting_ocpstoragelineitem_daily using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add namespace index for like trigram ops */\ncreate index if not exists ocp_storage_li_namespace_like_idx\n    on reporting_ocpstoragelineitem_daily using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocp_storage_li_node_like_idx\n    on reporting_ocpstoragelineitem_daily using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (8364, 8767), False, 'from django.db import migrations\n'), ((8814, 9044), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add node index for like trigram ops */\ncreate index if not exists ocpazure_node_like_idx\n    on reporting_ocpazurecostlineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add node index for like trigram ops */\ncreate index if not exists ocpazure_node_like_idx\n    on reporting_ocpazurecostlineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (8831, 9044), False, 'from django.db import migrations\n'), ((9099, 9553), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add namespace index for like trigram ops */\ncreate index if not exists ocpazure_proj_namespace_like_idx\n    on reporting_ocpazurecostlineitem_project_daily_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocpazure_proj_node_like_idx\n    on reporting_ocpazurecostlineitem_project_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add namespace index for like trigram ops */\ncreate index if not exists ocpazure_proj_namespace_like_idx\n    on reporting_ocpazurecostlineitem_project_daily_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocpazure_proj_node_like_idx\n    on reporting_ocpazurecostlineitem_project_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (9116, 9553), False, 'from django.db import migrations\n'), ((9628, 9860), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add node index for like trigram ops */\ncreate index if not exists cost_summary_node_like_idx\n    on reporting_ocpawscostlineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add node index for like trigram ops */\ncreate index if not exists cost_summary_node_like_idx\n    on reporting_ocpawscostlineitem_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (9645, 9860), False, 'from django.db import migrations\n'), ((9943, 10395), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add namespace index for like trigram ops */\ncreate index if not exists cost__proj_sum_namespace_like_idx\n    on reporting_ocpawscostlineitem_project_daily_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists cost__proj_sum_node_like_idx\n    on reporting_ocpawscostlineitem_project_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add namespace index for like trigram ops */\ncreate index if not exists cost__proj_sum_namespace_like_idx\n    on reporting_ocpawscostlineitem_project_daily_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists cost__proj_sum_node_like_idx\n    on reporting_ocpawscostlineitem_project_daily_summary using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (9960, 10395), False, 'from django.db import migrations\n'), ((10454, 10850), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n/* add namespace index for like trigram ops */\ncreate index if not exists ocpcostsum_namespace_like_idx\n    on reporting_ocpcosts_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocpcostsum_node_like_idx\n    on reporting_ocpcosts_summary using gin (UPPER(node) gin_trgm_ops);\n            """'], {}), '(\n    """\n/* add namespace index for like trigram ops */\ncreate index if not exists ocpcostsum_namespace_like_idx\n    on reporting_ocpcosts_summary using gin (UPPER(namespace) gin_trgm_ops);\n\n/* add node index for like trigram ops */\ncreate index if not exists ocpcostsum_node_like_idx\n    on reporting_ocpcosts_summary using gin (UPPER(node) gin_trgm_ops);\n            """\n    )\n', (10471, 10850), False, 'from django.db import migrations\n'), ((10872, 21363), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\ndrop materialized view if exists reporting_ocpallcostlineitem_daily_summary;\n\ncreate materialized view if not exists reporting_ocpallcostlineitem_daily_summary as\n SELECT row_number() OVER () AS id,\n    lids.source_type,\n    lids.cluster_id,\n    lids.cluster_alias,\n    lids.namespace,\n    lids.node,\n    lids.resource_id,\n    lids.usage_start,\n    lids.usage_end,\n    lids.usage_account_id,\n    lids.account_alias_id,\n    lids.product_code,\n    lids.product_family,\n    lids.instance_type,\n    lids.region,\n    lids.availability_zone,\n    lids.tags,\n    lids.usage_amount,\n    lids.unit,\n    lids.unblended_cost,\n    lids.markup_cost,\n    lids.currency_code,\n    lids.shared_projects,\n    lids.project_costs\n   FROM ( SELECT \'AWS\'::text AS source_type,\n            reporting_ocpawscostlineitem_daily_summary.cluster_id,\n            reporting_ocpawscostlineitem_daily_summary.cluster_alias,\n            reporting_ocpawscostlineitem_daily_summary.namespace,\n            reporting_ocpawscostlineitem_daily_summary.node,\n            reporting_ocpawscostlineitem_daily_summary.resource_id,\n            reporting_ocpawscostlineitem_daily_summary.usage_start::date,\n            reporting_ocpawscostlineitem_daily_summary.usage_end::date,\n            reporting_ocpawscostlineitem_daily_summary.usage_account_id,\n            reporting_ocpawscostlineitem_daily_summary.account_alias_id,\n            reporting_ocpawscostlineitem_daily_summary.product_code,\n            reporting_ocpawscostlineitem_daily_summary.product_family,\n            reporting_ocpawscostlineitem_daily_summary.instance_type,\n            reporting_ocpawscostlineitem_daily_summary.region,\n            reporting_ocpawscostlineitem_daily_summary.availability_zone,\n            reporting_ocpawscostlineitem_daily_summary.tags,\n            reporting_ocpawscostlineitem_daily_summary.usage_amount,\n            reporting_ocpawscostlineitem_daily_summary.unit,\n            reporting_ocpawscostlineitem_daily_summary.unblended_cost,\n            reporting_ocpawscostlineitem_daily_summary.markup_cost,\n            reporting_ocpawscostlineitem_daily_summary.currency_code,\n            reporting_ocpawscostlineitem_daily_summary.shared_projects,\n            reporting_ocpawscostlineitem_daily_summary.project_costs\n           FROM reporting_ocpawscostlineitem_daily_summary\n          WHERE reporting_ocpawscostlineitem_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)\n        UNION\n         SELECT \'Azure\'::text AS source_type,\n            reporting_ocpazurecostlineitem_daily_summary.cluster_id,\n            reporting_ocpazurecostlineitem_daily_summary.cluster_alias,\n            reporting_ocpazurecostlineitem_daily_summary.namespace,\n            reporting_ocpazurecostlineitem_daily_summary.node,\n            reporting_ocpazurecostlineitem_daily_summary.resource_id,\n            reporting_ocpazurecostlineitem_daily_summary.usage_start::date,\n            reporting_ocpazurecostlineitem_daily_summary.usage_end::date,\n            reporting_ocpazurecostlineitem_daily_summary.subscription_guid AS usage_account_id,\n            NULL::integer AS account_alias_id,\n            reporting_ocpazurecostlineitem_daily_summary.service_name AS product_code,\n            NULL::character varying AS product_family,\n            reporting_ocpazurecostlineitem_daily_summary.instance_type,\n            reporting_ocpazurecostlineitem_daily_summary.resource_location AS region,\n            NULL::character varying AS availability_zone,\n            reporting_ocpazurecostlineitem_daily_summary.tags,\n            reporting_ocpazurecostlineitem_daily_summary.usage_quantity AS usage_amount,\n            reporting_ocpazurecostlineitem_daily_summary.unit_of_measure AS unit,\n            reporting_ocpazurecostlineitem_daily_summary.pretax_cost AS unblended_cost,\n            reporting_ocpazurecostlineitem_daily_summary.markup_cost,\n            reporting_ocpazurecostlineitem_daily_summary.currency AS currency_code,\n            reporting_ocpazurecostlineitem_daily_summary.shared_projects,\n            reporting_ocpazurecostlineitem_daily_summary.project_costs\n           FROM reporting_ocpazurecostlineitem_daily_summary\n          WHERE reporting_ocpazurecostlineitem_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)) lids\n          with no data;\n\ncreate index mv_reporting_ocpallcostlineitem_daily_summary_namespace_ix\n    on reporting_ocpallcostlineitem_daily_summary using gin (namespace);\ncreate index mv_reporting_ocpallcostlineitem_daily_summary_node_ix\n    on reporting_ocpallcostlineitem_daily_summary (node varchar_pattern_ops);\ncreate index mv_reporting_ocpallcostlineitem_daily_summary_usage_ix\n    on reporting_ocpallcostlineitem_daily_summary (usage_start);\n\n\ndrop materialized view if exists reporting_ocpallcostlineitem_project_daily_summary;\n\ncreate materialized view if not exists reporting_ocpallcostlineitem_project_daily_summary as\n SELECT row_number() OVER () AS id,\n    lids.source_type,\n    lids.cluster_id,\n    lids.cluster_alias,\n    lids.data_source,\n    lids.namespace,\n    lids.node,\n    lids.pod_labels,\n    lids.resource_id,\n    lids.usage_start,\n    lids.usage_end,\n    lids.usage_account_id,\n    lids.account_alias_id,\n    lids.product_code,\n    lids.product_family,\n    lids.instance_type,\n    lids.region,\n    lids.availability_zone,\n    lids.usage_amount,\n    lids.unit,\n    lids.unblended_cost,\n    lids.project_markup_cost,\n    lids.pod_cost,\n    lids.currency_code\n   FROM ( SELECT \'AWS\'::text AS source_type,\n            reporting_ocpawscostlineitem_project_daily_summary.cluster_id,\n            reporting_ocpawscostlineitem_project_daily_summary.cluster_alias,\n            reporting_ocpawscostlineitem_project_daily_summary.data_source,\n            reporting_ocpawscostlineitem_project_daily_summary.namespace,\n            reporting_ocpawscostlineitem_project_daily_summary.node,\n            reporting_ocpawscostlineitem_project_daily_summary.pod_labels,\n            reporting_ocpawscostlineitem_project_daily_summary.resource_id,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_start::date,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_end::date,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_account_id,\n            reporting_ocpawscostlineitem_project_daily_summary.account_alias_id,\n            reporting_ocpawscostlineitem_project_daily_summary.product_code,\n            reporting_ocpawscostlineitem_project_daily_summary.product_family,\n            reporting_ocpawscostlineitem_project_daily_summary.instance_type,\n            reporting_ocpawscostlineitem_project_daily_summary.region,\n            reporting_ocpawscostlineitem_project_daily_summary.availability_zone,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_amount,\n            reporting_ocpawscostlineitem_project_daily_summary.unit,\n            reporting_ocpawscostlineitem_project_daily_summary.unblended_cost,\n            reporting_ocpawscostlineitem_project_daily_summary.project_markup_cost,\n            reporting_ocpawscostlineitem_project_daily_summary.pod_cost,\n            reporting_ocpawscostlineitem_project_daily_summary.currency_code\n           FROM reporting_ocpawscostlineitem_project_daily_summary\n          WHERE reporting_ocpawscostlineitem_project_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)\n        UNION\n         SELECT \'Azure\'::text AS source_type,\n            reporting_ocpazurecostlineitem_project_daily_summary.cluster_id,\n            reporting_ocpazurecostlineitem_project_daily_summary.cluster_alias,\n            reporting_ocpazurecostlineitem_project_daily_summary.data_source,\n            reporting_ocpazurecostlineitem_project_daily_summary.namespace,\n            reporting_ocpazurecostlineitem_project_daily_summary.node,\n            reporting_ocpazurecostlineitem_project_daily_summary.pod_labels,\n            reporting_ocpazurecostlineitem_project_daily_summary.resource_id,\n            reporting_ocpazurecostlineitem_project_daily_summary.usage_start::date,\n            reporting_ocpazurecostlineitem_project_daily_summary.usage_end::date,\n            reporting_ocpazurecostlineitem_project_daily_summary.subscription_guid AS usage_account_id,\n            NULL::integer AS account_alias_id,\n            reporting_ocpazurecostlineitem_project_daily_summary.service_name AS product_code,\n            NULL::character varying AS product_family,\n            reporting_ocpazurecostlineitem_project_daily_summary.instance_type,\n            reporting_ocpazurecostlineitem_project_daily_summary.resource_location AS region,\n            NULL::character varying AS availability_zone,\n            reporting_ocpazurecostlineitem_project_daily_summary.usage_quantity AS usage_amount,\n            reporting_ocpazurecostlineitem_project_daily_summary.unit_of_measure AS unit,\n            reporting_ocpazurecostlineitem_project_daily_summary.pretax_cost AS unblended_cost,\n            reporting_ocpazurecostlineitem_project_daily_summary.project_markup_cost,\n            reporting_ocpazurecostlineitem_project_daily_summary.pod_cost,\n            reporting_ocpazurecostlineitem_project_daily_summary.currency AS currency_code\n           FROM reporting_ocpazurecostlineitem_project_daily_summary\n          WHERE reporting_ocpazurecostlineitem_project_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)) lids\n          with no data;\n\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_namespace_ix\n    on reporting_ocpallcostlineitem_project_daily_summary (namespace varchar_pattern_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_node_ix\n    on reporting_ocpallcostlineitem_project_daily_summary (node varchar_pattern_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_namespace_like_ix\n    on reporting_ocpallcostlineitem_project_daily_summary using gin (namespace gin_trgm_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_node_like_ix\n    on reporting_ocpallcostlineitem_project_daily_summary using gin (node gin_trgm_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_usage_ix\n    on reporting_ocpallcostlineitem_project_daily_summary (usage_start);\n            """'], {}), '(\n    """\ndrop materialized view if exists reporting_ocpallcostlineitem_daily_summary;\n\ncreate materialized view if not exists reporting_ocpallcostlineitem_daily_summary as\n SELECT row_number() OVER () AS id,\n    lids.source_type,\n    lids.cluster_id,\n    lids.cluster_alias,\n    lids.namespace,\n    lids.node,\n    lids.resource_id,\n    lids.usage_start,\n    lids.usage_end,\n    lids.usage_account_id,\n    lids.account_alias_id,\n    lids.product_code,\n    lids.product_family,\n    lids.instance_type,\n    lids.region,\n    lids.availability_zone,\n    lids.tags,\n    lids.usage_amount,\n    lids.unit,\n    lids.unblended_cost,\n    lids.markup_cost,\n    lids.currency_code,\n    lids.shared_projects,\n    lids.project_costs\n   FROM ( SELECT \'AWS\'::text AS source_type,\n            reporting_ocpawscostlineitem_daily_summary.cluster_id,\n            reporting_ocpawscostlineitem_daily_summary.cluster_alias,\n            reporting_ocpawscostlineitem_daily_summary.namespace,\n            reporting_ocpawscostlineitem_daily_summary.node,\n            reporting_ocpawscostlineitem_daily_summary.resource_id,\n            reporting_ocpawscostlineitem_daily_summary.usage_start::date,\n            reporting_ocpawscostlineitem_daily_summary.usage_end::date,\n            reporting_ocpawscostlineitem_daily_summary.usage_account_id,\n            reporting_ocpawscostlineitem_daily_summary.account_alias_id,\n            reporting_ocpawscostlineitem_daily_summary.product_code,\n            reporting_ocpawscostlineitem_daily_summary.product_family,\n            reporting_ocpawscostlineitem_daily_summary.instance_type,\n            reporting_ocpawscostlineitem_daily_summary.region,\n            reporting_ocpawscostlineitem_daily_summary.availability_zone,\n            reporting_ocpawscostlineitem_daily_summary.tags,\n            reporting_ocpawscostlineitem_daily_summary.usage_amount,\n            reporting_ocpawscostlineitem_daily_summary.unit,\n            reporting_ocpawscostlineitem_daily_summary.unblended_cost,\n            reporting_ocpawscostlineitem_daily_summary.markup_cost,\n            reporting_ocpawscostlineitem_daily_summary.currency_code,\n            reporting_ocpawscostlineitem_daily_summary.shared_projects,\n            reporting_ocpawscostlineitem_daily_summary.project_costs\n           FROM reporting_ocpawscostlineitem_daily_summary\n          WHERE reporting_ocpawscostlineitem_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)\n        UNION\n         SELECT \'Azure\'::text AS source_type,\n            reporting_ocpazurecostlineitem_daily_summary.cluster_id,\n            reporting_ocpazurecostlineitem_daily_summary.cluster_alias,\n            reporting_ocpazurecostlineitem_daily_summary.namespace,\n            reporting_ocpazurecostlineitem_daily_summary.node,\n            reporting_ocpazurecostlineitem_daily_summary.resource_id,\n            reporting_ocpazurecostlineitem_daily_summary.usage_start::date,\n            reporting_ocpazurecostlineitem_daily_summary.usage_end::date,\n            reporting_ocpazurecostlineitem_daily_summary.subscription_guid AS usage_account_id,\n            NULL::integer AS account_alias_id,\n            reporting_ocpazurecostlineitem_daily_summary.service_name AS product_code,\n            NULL::character varying AS product_family,\n            reporting_ocpazurecostlineitem_daily_summary.instance_type,\n            reporting_ocpazurecostlineitem_daily_summary.resource_location AS region,\n            NULL::character varying AS availability_zone,\n            reporting_ocpazurecostlineitem_daily_summary.tags,\n            reporting_ocpazurecostlineitem_daily_summary.usage_quantity AS usage_amount,\n            reporting_ocpazurecostlineitem_daily_summary.unit_of_measure AS unit,\n            reporting_ocpazurecostlineitem_daily_summary.pretax_cost AS unblended_cost,\n            reporting_ocpazurecostlineitem_daily_summary.markup_cost,\n            reporting_ocpazurecostlineitem_daily_summary.currency AS currency_code,\n            reporting_ocpazurecostlineitem_daily_summary.shared_projects,\n            reporting_ocpazurecostlineitem_daily_summary.project_costs\n           FROM reporting_ocpazurecostlineitem_daily_summary\n          WHERE reporting_ocpazurecostlineitem_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)) lids\n          with no data;\n\ncreate index mv_reporting_ocpallcostlineitem_daily_summary_namespace_ix\n    on reporting_ocpallcostlineitem_daily_summary using gin (namespace);\ncreate index mv_reporting_ocpallcostlineitem_daily_summary_node_ix\n    on reporting_ocpallcostlineitem_daily_summary (node varchar_pattern_ops);\ncreate index mv_reporting_ocpallcostlineitem_daily_summary_usage_ix\n    on reporting_ocpallcostlineitem_daily_summary (usage_start);\n\n\ndrop materialized view if exists reporting_ocpallcostlineitem_project_daily_summary;\n\ncreate materialized view if not exists reporting_ocpallcostlineitem_project_daily_summary as\n SELECT row_number() OVER () AS id,\n    lids.source_type,\n    lids.cluster_id,\n    lids.cluster_alias,\n    lids.data_source,\n    lids.namespace,\n    lids.node,\n    lids.pod_labels,\n    lids.resource_id,\n    lids.usage_start,\n    lids.usage_end,\n    lids.usage_account_id,\n    lids.account_alias_id,\n    lids.product_code,\n    lids.product_family,\n    lids.instance_type,\n    lids.region,\n    lids.availability_zone,\n    lids.usage_amount,\n    lids.unit,\n    lids.unblended_cost,\n    lids.project_markup_cost,\n    lids.pod_cost,\n    lids.currency_code\n   FROM ( SELECT \'AWS\'::text AS source_type,\n            reporting_ocpawscostlineitem_project_daily_summary.cluster_id,\n            reporting_ocpawscostlineitem_project_daily_summary.cluster_alias,\n            reporting_ocpawscostlineitem_project_daily_summary.data_source,\n            reporting_ocpawscostlineitem_project_daily_summary.namespace,\n            reporting_ocpawscostlineitem_project_daily_summary.node,\n            reporting_ocpawscostlineitem_project_daily_summary.pod_labels,\n            reporting_ocpawscostlineitem_project_daily_summary.resource_id,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_start::date,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_end::date,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_account_id,\n            reporting_ocpawscostlineitem_project_daily_summary.account_alias_id,\n            reporting_ocpawscostlineitem_project_daily_summary.product_code,\n            reporting_ocpawscostlineitem_project_daily_summary.product_family,\n            reporting_ocpawscostlineitem_project_daily_summary.instance_type,\n            reporting_ocpawscostlineitem_project_daily_summary.region,\n            reporting_ocpawscostlineitem_project_daily_summary.availability_zone,\n            reporting_ocpawscostlineitem_project_daily_summary.usage_amount,\n            reporting_ocpawscostlineitem_project_daily_summary.unit,\n            reporting_ocpawscostlineitem_project_daily_summary.unblended_cost,\n            reporting_ocpawscostlineitem_project_daily_summary.project_markup_cost,\n            reporting_ocpawscostlineitem_project_daily_summary.pod_cost,\n            reporting_ocpawscostlineitem_project_daily_summary.currency_code\n           FROM reporting_ocpawscostlineitem_project_daily_summary\n          WHERE reporting_ocpawscostlineitem_project_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)\n        UNION\n         SELECT \'Azure\'::text AS source_type,\n            reporting_ocpazurecostlineitem_project_daily_summary.cluster_id,\n            reporting_ocpazurecostlineitem_project_daily_summary.cluster_alias,\n            reporting_ocpazurecostlineitem_project_daily_summary.data_source,\n            reporting_ocpazurecostlineitem_project_daily_summary.namespace,\n            reporting_ocpazurecostlineitem_project_daily_summary.node,\n            reporting_ocpazurecostlineitem_project_daily_summary.pod_labels,\n            reporting_ocpazurecostlineitem_project_daily_summary.resource_id,\n            reporting_ocpazurecostlineitem_project_daily_summary.usage_start::date,\n            reporting_ocpazurecostlineitem_project_daily_summary.usage_end::date,\n            reporting_ocpazurecostlineitem_project_daily_summary.subscription_guid AS usage_account_id,\n            NULL::integer AS account_alias_id,\n            reporting_ocpazurecostlineitem_project_daily_summary.service_name AS product_code,\n            NULL::character varying AS product_family,\n            reporting_ocpazurecostlineitem_project_daily_summary.instance_type,\n            reporting_ocpazurecostlineitem_project_daily_summary.resource_location AS region,\n            NULL::character varying AS availability_zone,\n            reporting_ocpazurecostlineitem_project_daily_summary.usage_quantity AS usage_amount,\n            reporting_ocpazurecostlineitem_project_daily_summary.unit_of_measure AS unit,\n            reporting_ocpazurecostlineitem_project_daily_summary.pretax_cost AS unblended_cost,\n            reporting_ocpazurecostlineitem_project_daily_summary.project_markup_cost,\n            reporting_ocpazurecostlineitem_project_daily_summary.pod_cost,\n            reporting_ocpazurecostlineitem_project_daily_summary.currency AS currency_code\n           FROM reporting_ocpazurecostlineitem_project_daily_summary\n          WHERE reporting_ocpazurecostlineitem_project_daily_summary.usage_start >= date_trunc(\'month\'::text, date_trunc(\'month\'::text, now()) - \'1 day\'::interval day)) lids\n          with no data;\n\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_namespace_ix\n    on reporting_ocpallcostlineitem_project_daily_summary (namespace varchar_pattern_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_node_ix\n    on reporting_ocpallcostlineitem_project_daily_summary (node varchar_pattern_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_namespace_like_ix\n    on reporting_ocpallcostlineitem_project_daily_summary using gin (namespace gin_trgm_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_node_like_ix\n    on reporting_ocpallcostlineitem_project_daily_summary using gin (node gin_trgm_ops);\ncreate index mv_reporting_ocpallcostlineitem_prj_daily_summary_usage_ix\n    on reporting_ocpallcostlineitem_project_daily_summary (usage_start);\n            """\n    )\n', (10889, 21363), False, 'from django.db import migrations\n'), ((21385, 21581), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\nrefresh materialized view reporting_ocpallcostlineitem_daily_summary;\nrefresh materialized view reporting_ocpallcostlineitem_project_daily_summary;\n            """'], {}), '(\n    """\nrefresh materialized view reporting_ocpallcostlineitem_daily_summary;\nrefresh materialized view reporting_ocpallcostlineitem_project_daily_summary;\n            """\n    )\n', (21402, 21581), False, 'from django.db import migrations\n'), ((1736, 1754), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (1752, 1754), False, 'from django.db import models\n'), ((1887, 1905), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (1903, 1905), False, 'from django.db import models\n'), ((2031, 2049), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2047, 2049), False, 'from django.db import models\n'), ((2177, 2195), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2193, 2195), False, 'from django.db import models\n'), ((2328, 2346), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2344, 2346), False, 'from django.db import models\n'), ((2481, 2499), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2497, 2499), False, 'from django.db import models\n'), ((2603, 2621), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2619, 2621), False, 'from django.db import models\n'), ((2718, 2736), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2734, 2736), False, 'from django.db import models\n'), ((2833, 2854), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (2852, 2854), False, 'from django.db import models\n'), ((2947, 2965), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (2963, 2965), False, 'from django.db import models\n'), ((3060, 3078), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (3076, 3078), False, 'from django.db import models\n'), ((3178, 3196), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (3194, 3196), False, 'from django.db import models\n'), ((3298, 3316), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (3314, 3316), False, 'from django.db import models\n'), ((3423, 3522), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""cost_summary_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='cost_summary_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (3435, 3522), False, 'from django.db import models\n'), ((3641, 3751), 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""cost__proj_sum_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['namespace'], name='cost__proj_sum_namespace_idx',\n    opclasses=['varchar_pattern_ops'])\n", (3653, 3751), False, 'from django.db import models\n'), ((3901, 4001), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""cost_proj_sum_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='cost_proj_sum_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (3913, 4001), False, 'from django.db import models\n'), ((4115, 4210), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocpazure_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='ocpazure_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (4127, 4210), False, 'from django.db import models\n'), ((4331, 4440), 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""ocpazure_proj_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['namespace'], name='ocpazure_proj_namespace_idx',\n    opclasses=['varchar_pattern_ops'])\n", (4343, 4440), False, 'from django.db import models\n'), ((4592, 4692), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocpazure_proj_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='ocpazure_proj_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (4604, 4692), False, 'from django.db import models\n'), ((4797, 4907), 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""ocp_storage_li_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['namespace'], name='ocp_storage_li_namespace_idx',\n    opclasses=['varchar_pattern_ops'])\n", (4809, 4907), False, 'from django.db import models\n'), ((5043, 5144), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocp_storage_li_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='ocp_storage_li_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (5055, 5144), False, 'from django.db import models\n'), ((5247, 5343), 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['namespace'], name='namespace_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (5259, 5343), False, 'from django.db import models\n'), ((5446, 5532), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (5458, 5532), False, 'from django.db import models\n'), ((5642, 5746), 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""summary_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['namespace'], name='summary_namespace_idx', opclasses=\n    ['varchar_pattern_ops'])\n", (5654, 5746), False, 'from django.db import models\n'), ((5856, 5950), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""summary_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='summary_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (5868, 5950), False, 'from django.db import models\n'), ((6038, 6056), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (6054, 6056), False, 'from django.db import models\n'), ((6141, 6159), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (6157, 6159), False, 'from django.db import models\n'), ((6235, 6306), 'django.db.models.Index', 'models.Index', ([], {'fields': "['usage_start']", 'name': '"""ocpcostsum_usage_start_idx"""'}), "(fields=['usage_start'], name='ocpcostsum_usage_start_idx')\n", (6247, 6306), False, 'from django.db import models\n'), ((6403, 6509), 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""ocpcostsum_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['namespace'], name='ocpcostsum_namespace_idx',\n    opclasses=['varchar_pattern_ops'])\n", (6415, 6509), False, 'from django.db import models\n'), ((6633, 6730), 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocpcostsum_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), "(fields=['node'], name='ocpcostsum_node_idx', opclasses=[\n    'varchar_pattern_ops'])\n", (6645, 6730), False, 'from django.db import models\n')]