# Generated by Django 1.11.18 on 2020-09-17 15:38

from django.db import migrations


class Migration(migrations.Migration):
    dependencies = [
        ('authentic2', '0027_remove_deleteduser'),
    ]

    operations = [
        migrations.RunSQL(
            sql=[
                "CREATE EXTENSION IF NOT EXISTS unaccent SCHEMA public",
                "CREATE EXTENSION IF NOT EXISTS pg_trgm SCHEMA public",
                "CREATE OR REPLACE FUNCTION public.immutable_unaccent(text) RETURNS varchar AS $$ "
                "SELECT public.unaccent('public.unaccent',$1::text); $$ LANGUAGE 'sql' IMMUTABLE",
                "CREATE INDEX custom_user_name_gist_idx ON custom_user_user USING gist "
                "(LOWER(public.immutable_unaccent(first_name || ' ' || last_name)) public.gist_trgm_ops)",
            ],
            reverse_sql=[
                "DROP INDEX IF EXISTS custom_user_name_gist_idx",
                "DROP FUNCTION IF EXISTS public.immutable_unaccent(text)",
                "DROP EXTENSION IF EXISTS pg_trgm",
                "DROP EXTENSION IF EXISTS unaccent",
            ],
        ),
    ]
