# Generated by Django 2.2.7 on 2020-11-02 13:27

from django.db import migrations, connection


def eliminar_indices(apps, schema_editor):
    cursor = connection.cursor()
    sql = ("DROP INDEX history_date_index")
    cursor.execute(sql)
    cursor = connection.cursor()
    sql = ("DROP INDEX calif_cliente_callid_index")
    cursor.execute(sql)


def adicionar_indices(apps, schema_editor):
    cursor = connection.cursor()
    sql = ("CREATE INDEX history_date_index ON "
           "ominicontacto_app_historicalcalificacioncliente (history_date)")
    cursor.execute(sql)
    cursor = connection.cursor()
    sql = "REINDEX index history_date_index"
    cursor.execute(sql)
    cursor = connection.cursor()
    sql = ("CREATE INDEX calif_cliente_callid_index ON "
           "ominicontacto_app_calificacioncliente (callid)")
    cursor.execute(sql)
    cursor = connection.cursor()
    sql = "REINDEX index calif_cliente_callid_index"
    cursor.execute(sql)


class Migration(migrations.Migration):

    dependencies = [
        ('ominicontacto_app', '0065_cambio_valor_setting_key_server'),
    ]

    operations = [
        migrations.RunPython(adicionar_indices, eliminar_indices),
    ]
