# 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;
            """
        ),
    ]

[(12, '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            """'], {}), False, 'from django.db import migrations\n'), (18, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpawscostlineitemdailysummary"""', 'name': '"""cost_summary_node_idx"""'}), False, 'from django.db import migrations\n'), (19, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpawscostlineitemprojectdailysummary"""', 'name': '"""cost__proj_sum_namespace_idx"""'}), False, 'from django.db import migrations\n'), (22, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpawscostlineitemprojectdailysummary"""', 'name': '"""cost_proj_sum_node_idx"""'}), False, 'from django.db import migrations\n'), (23, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpazurecostlineitemdailysummary"""', 'name': '"""ocpazure_node_idx"""'}), False, 'from django.db import migrations\n'), (24, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpazurecostlineitemprojectdailysummary"""', 'name': '"""ocpazure_proj_namespace_idx"""'}), False, 'from django.db import migrations\n'), (27, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpazurecostlineitemprojectdailysummary"""', 'name': '"""ocpazure_proj_node_idx"""'}), False, 'from django.db import migrations\n'), (28, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdaily"""', 'name': '"""namespace_idx"""'}), False, 'from django.db import migrations\n'), (29, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdaily"""', 'name': '"""node_idx"""'}), False, 'from django.db import migrations\n'), (30, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdailysummary"""', 'name': '"""summary_namespace_idx"""'}), False, 'from django.db import migrations\n'), (31, 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""ocpusagelineitemdailysummary"""', 'name': '"""summary_node_idx"""'}), False, 'from django.db import migrations\n'), (132, 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\ncreate extension if not exists pg_trgm schema public;\n            """'], {}), False, 'from django.db import migrations\n'), (141, '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            """'], {}), False, 'from django.db import migrations\n'), (153, '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            """'], {}), False, 'from django.db import migrations\n'), (165, '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            """'], {}), False, 'from django.db import migrations\n'), (177, '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            """'], {}), False, 'from django.db import migrations\n'), (185, '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            """'], {}), False, 'from django.db import migrations\n'), (197, '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            """'], {}), False, 'from django.db import migrations\n'), (205, '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            """'], {}), False, 'from django.db import migrations\n'), (217, '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            """'], {}), False, 'from django.db import migrations\n'), (228, '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            """'], {}), False, 'from django.db import migrations\n'), (410, 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\nrefresh materialized view reporting_ocpallcostlineitem_daily_summary;\nrefresh materialized view reporting_ocpallcostlineitem_project_daily_summary;\n            """'], {}), False, 'from django.db import migrations\n'), (33, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (36, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (39, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (42, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (45, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (48, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (50, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (51, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (52, 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), False, 'from django.db import models\n'), (53, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (54, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (55, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (56, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (59, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""cost_summary_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (63, 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""cost__proj_sum_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (69, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""cost_proj_sum_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (73, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocpazure_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (77, 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""ocpazure_proj_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (83, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocpazure_proj_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (87, 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""ocp_storage_li_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (93, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocp_storage_li_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (97, 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (101, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (105, 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""summary_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (109, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""summary_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (111, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (112, 'django.db.models.DateField', 'models.DateField', ([], {}), False, 'from django.db import models\n'), (114, 'django.db.models.Index', 'models.Index', ([], {'fields': "['usage_start']", 'name': '"""ocpcostsum_usage_start_idx"""'}), False, 'from django.db import models\n'), (118, 'django.db.models.Index', 'models.Index', ([], {'fields': "['namespace']", 'name': '"""ocpcostsum_namespace_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n'), (124, 'django.db.models.Index', 'models.Index', ([], {'fields': "['node']", 'name': '"""ocpcostsum_node_idx"""', 'opclasses': "['varchar_pattern_ops']"}), False, 'from django.db import models\n')]