from django.db import migrations


class Migration(migrations.Migration):
    """ Create a unique case-insensitive index on the username column """

    dependencies = [
        ('auth', '0001_initial'),
    ]

    operations = [
        migrations.RunSQL(
            'CREATE UNIQUE INDEX user_case_insensitive_unique '
            'ON auth_user ((lower(username)));',
            'DROP INDEX user_case_insensitive_unique',
        ),
    ]

Add case-insensitive unique index for username
Add case-insensitive unique index for username
