49 lines
1.9 KiB
Python
49 lines
1.9 KiB
Python
"""add_game_challenges_table
|
|
|
|
Revision ID: 29da7c818b01
|
|
Revises: a1b2c3d4e5f6
|
|
Create Date: 2026-03-28 23:20:21.949520
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '29da7c818b01'
|
|
down_revision: Union[str, Sequence[str], None] = 'a1b2c3d4e5f6'
|
|
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('game_challenges',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('challenger_id', sa.UUID(), nullable=False),
|
|
sa.Column('challenged_id', sa.UUID(), nullable=False),
|
|
sa.Column('challenger_deck_id', sa.UUID(), nullable=False),
|
|
sa.Column('status', sa.String(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
|
sa.ForeignKeyConstraint(['challenged_id'], ['users.id'], ),
|
|
sa.ForeignKeyConstraint(['challenger_deck_id'], ['decks.id'], ),
|
|
sa.ForeignKeyConstraint(['challenger_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.drop_index(op.f('ix_trade_proposals_proposer_status'), table_name='trade_proposals')
|
|
op.drop_index(op.f('ix_trade_proposals_recipient_status'), table_name='trade_proposals')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_index(op.f('ix_trade_proposals_recipient_status'), 'trade_proposals', ['recipient_id', 'status'], unique=False)
|
|
op.create_index(op.f('ix_trade_proposals_proposer_status'), 'trade_proposals', ['proposer_id', 'status'], unique=False)
|
|
op.drop_table('game_challenges')
|
|
# ### end Alembic commands ###
|