"""org_invitation_unique_email_org

Revision ID: b22e78f9a6bc
Revises: a1b2c3d4e5f7
Create Date: 2026-01-23 12:20:13.748876

"""

from collections.abc import Sequence

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "b22e78f9a6bc"
down_revision: str | None = "a1b2c3d4e5f7"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(
        "ix_organization_invitation_email", table_name="organization_invitation"
    )
    op.create_unique_constraint(
        op.f("uq_organization_invitation_email_organization_id"),
        "organization_invitation",
        ["email", "organization_id"],
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(
        op.f("uq_organization_invitation_email_organization_id"),
        "organization_invitation",
        type_="unique",
    )
    op.create_index(
        "ix_organization_invitation_email",
        "organization_invitation",
        ["email"],
        unique=False,
    )
    # ### end Alembic commands ###
