# Generated by Django 5.2.8 on 2025-11-20 09:56

from django.db import migrations


class Migration(migrations.Migration):
    dependencies = [
        ("core", "0026_comments"),
    ]

    operations = [
        migrations.RunSQL(
            sql="""
                CREATE OR REPLACE FUNCTION public.immutable_unaccent(regdictionary, text)
                RETURNS text
                LANGUAGE c IMMUTABLE PARALLEL SAFE STRICT AS
                '$libdir/unaccent', 'unaccent_dict';

                CREATE OR REPLACE FUNCTION public.f_unaccent(text)
                RETURNS text
                LANGUAGE sql IMMUTABLE PARALLEL SAFE STRICT
                RETURN public.immutable_unaccent(regdictionary 'public.unaccent', $1);

                CREATE INDEX IF NOT EXISTS user_email_unaccent_trgm_idx
                ON impress_user
                USING gin (f_unaccent(email) gin_trgm_ops);

                CREATE INDEX IF NOT EXISTS user_full_name_unaccent_trgm_idx
                ON impress_user
                USING gin (f_unaccent(full_name) gin_trgm_ops);
            """,
            reverse_sql="""
                DROP INDEX IF EXISTS user_email_unaccent_trgm_idx;
                DROP INDEX IF EXISTS user_full_name_unaccent_trgm_idx;
            """,
        ),
    ]
