new_contents: # Generated by Django 3.2.8 on 2021-11-01 16:41
  
  from django.db import migrations
  
  # language=SQL
  INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED_SCHEME_NOT_NULL = """
  CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_scheme_not_null_used on stats_contactactivity (org_id, date, scheme, used) WHERE scheme IS NOT NULL and used is TRUE;
  """
  
  
  # language=SQL
  INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED_GENDER_NOT_NULL = """
  CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_gender_not_null_used on stats_contactactivity (org_id, date, gender, used) WHERE gender IS NOT NULL and used is TRUE;
  """
  
  # language=SQL
  INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED_STATE_NOT_NULL = """
  CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_state_not_null_used on stats_contactactivity (org_id, date, state, used) WHERE state IS NOT NULL and used is TRUE;
  """
  
  # language=SQL
  INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED = """
  CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_usedb on stats_contactactivity (org_id, date, used) WHERE used is TRUE;
  """
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ("stats", "0021_better_indexes"),
      ]
  
      operations = [
          migrations.RunSQL(INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED_SCHEME_NOT_NULL, ""),
          migrations.RunSQL(INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED_GENDER_NOT_NULL, ""),
          migrations.RunSQL(INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED_STATE_NOT_NULL, ""),
          migrations.RunSQL(INDEX_SQL_CONTACTACTIVITY_ORG_DATE_USED, ""),
      ]
  
subject: Rebuild indexes properly