"""Add performance nicknames

Revision ID: bc32a0b7efbb
Revises: 341b95b6e098
Create Date: 2025-12-02 03:16:05.516007

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel


# revision identifiers, used by Alembic.
revision: str = 'bc32a0b7efbb'
down_revision: Union[str, Sequence[str], None] = '341b95b6e098'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('performancenickname',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('performance_id', sa.Integer(), nullable=False),
    sa.Column('nickname', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
    sa.Column('status', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('suggested_by', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['performance_id'], ['performance.id'], ),
    sa.ForeignKeyConstraint(['suggested_by'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    with op.batch_alter_table('performancenickname', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_performancenickname_nickname'), ['nickname'], unique=False)
        batch_op.create_index(batch_op.f('ix_performancenickname_status'), ['status'], unique=False)

    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('performancenickname', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_performancenickname_status'))
        batch_op.drop_index(batch_op.f('ix_performancenickname_nickname'))

    op.drop_table('performancenickname')
    # ### end Alembic commands ###
