"""Add unique index to members Revision ID: a000d800f45f Revises: 17cc8cb77be5 Create Date: 2024-03-21 15:52:09.403257 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "a000d800f45f" down_revision: Union[str, None] = "17cc8cb77be5" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.create_index( "members_user_name_idx", "members", ["user_id", sa.text("lower(name)")], unique=True, ) def downgrade() -> None: op.drop_index("members_user_name_idx", table_name="members")