"""
Add GIN index for Company.roles ArrayField.

This improves query performance for queries like:
    Company.objects.filter(roles__contains=["MANUFACTURER"])
    Company.objects.filter(roles__contains=["OPERATOR"])

GIN indexes are specifically designed for array containment queries in PostgreSQL.
"""

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ("parks", "0022_alter_company_roles_alter_companyevent_roles"),
    ]

    operations = [
        migrations.RunSQL(
            sql="CREATE INDEX IF NOT EXISTS parks_company_roles_gin_idx ON parks_company USING gin(roles);",
            reverse_sql="DROP INDEX IF EXISTS parks_company_roles_gin_idx;",
        ),
    ]
