"""Make UserCustomer.customer_id unique

Revision ID: 58d5e316549f
Revises: 6a6e872cbea5
Create Date: 2025-01-02 16:56:16.433658

"""

import sqlalchemy as sa
from alembic import op

# Polar Custom Imports

# revision identifiers, used by Alembic.
revision = "58d5e316549f"
down_revision = "6a6e872cbea5"
branch_labels: tuple[str] | None = None
depends_on: tuple[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(
        "user_customers_user_id_customer_id_key", "user_customers", type_="unique"
    )
    op.create_unique_constraint(
        op.f("user_customers_customer_id_key"), "user_customers", ["customer_id"]
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(
        op.f("user_customers_customer_id_key"), "user_customers", type_="unique"
    )
    op.create_unique_constraint(
        "user_customers_user_id_customer_id_key",
        "user_customers",
        ["user_id", "customer_id"],
    )
    # ### end Alembic commands ###
