"""Add alias to Prompt table

Revision ID: cbba80f89a32
Revises: 6de4fe1a2745
Create Date: 2025-09-12 17:57:19.143494

"""

from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "cbba80f89a32"
down_revision: str | None = "6de4fe1a2745"
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.add_column("prompt", sa.Column("alias", sa.String(), nullable=True))
    op.create_unique_constraint(
        "uq_prompt_alias_owner_id", "prompt", ["alias", "owner_id"]
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint("uq_prompt_alias_owner_id", "prompt", type_="unique")
    op.drop_column("prompt", "alias")
    # ### end Alembic commands ###
