# Generated by Django 3.2.6 on 2021-09-27 17:49

from django.db import migrations

INDEX_POLLSTATS_ORG_RESULT_SQL = """
CREATE INDEX IF NOT EXISTS stats_pollstats_org_result on stats_pollstats (org_id, flow_result_id) WHERE flow_result_id IS NOT NULL;
"""


INDEX_POLLSTATS_ORG_QST_RST_CAT_SQL = """
CREATE INDEX IF NOT EXISTS stats_pollstats_org_qstn_rslt_cat_age_gndr_schm_date_not_null on stats_pollstats (org_id, question_id, flow_result_id, category_id, flow_result_category_id, age_segment_id, gender_segment_id, scheme_segment_id, location_id, date) WHERE date IS NOT NULL;
"""


class Migration(migrations.Migration):

    dependencies = [
        ("stats", "0016_pollstats_scheme_segment"),
    ]

    operations = [
        migrations.RunSQL(INDEX_POLLSTATS_ORG_RESULT_SQL),
        migrations.RunSQL(INDEX_POLLSTATS_ORG_QST_RST_CAT_SQL),
    ]

# Generated by Django 3.2.6 on 2021-09-27 17:49

from django.db import migrations

INDEX_POLLSTATS_ORG_RESULT_SQL = """
CREATE INDEX IF NOT EXISTS stats_pollstats_org_result on stats_pollstats (org_id, flow_result_id) WHERE flow_result_id IS NOT NULL;
"""


INDEX_POLLSTATS_ORG_QST_RST_CAT_SQL = """
CREATE INDEX IF NOT EXISTS stats_pollstats_org_qstn_rslt_cat_age_gndr_schm_date_not_null on stats_pollstats (org_id, question_id, flow_result_id, category_id, flow_result_category_id, age_segment_id, gender_segment_id, scheme_segment_id, location_id, date) WHERE date IS NOT NULL;
"""


class Migration(migrations.Migration):

    dependencies = [
        ("stats", "0016_pollstats_scheme_segment"),
    ]

    operations = [
        migrations.RunSQL(INDEX_POLLSTATS_ORG_RESULT_SQL, ""),
        migrations.RunSQL(INDEX_POLLSTATS_ORG_QST_RST_CAT_SQL, ""),
    ]

Add empty reverse migration to be able to unapply the migration in reverse