# Generated by Django 3.1.7 on 2021-04-01 15:27

from django.db import migrations

CREER_INDEX_RECHERCHE_SIMPLE = """
CREATE INDEX events_event_simple_search ON events_event USING GIN ((
setweight(to_tsvector('french_unaccented', COALESCE("name", '')), 'A')
|| setweight(to_tsvector('french_unaccented', COALESCE("location_name", '')), 'B')
|| setweight(to_tsvector('french_unaccented', COALESCE("location_city", '')), 'C')
));
"""

SUPPRIMER_INDEX_RECHERCHER_SIMPLE = """
DROP INDEX events_event_simple_search RESTRICT;
"""


class Migration(migrations.Migration):
    dependencies = [
        ("events", "0005_facebook_field_max_length"),
    ]

    operations = [
        migrations.RunSQL(
            sql=CREER_INDEX_RECHERCHE_SIMPLE,
            reverse_sql=SUPPRIMER_INDEX_RECHERCHER_SIMPLE,
        ),
    ]
