123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- """empty message
- Revision ID: d1be967e706a
- Revises: 020773f0f9a1
- Create Date: 2024-08-27 11:37:10.481634
- """
- from alembic import op
- import sqlalchemy as sa
- # revision identifiers, used by Alembic.
- revision = 'd1be967e706a'
- down_revision = '020773f0f9a1'
- branch_labels = None
- depends_on = None
- def upgrade():
- # ### commands auto generated by Alembic - please adjust! ###
- op.create_table('action_card',
- sa.Column('id', sa.Integer(), nullable=False),
- sa.Column('card_id', sa.Integer(), nullable=True),
- sa.Column('action', sa.String(length=500), nullable=True),
- sa.Column('img_path', sa.String(length=300), nullable=False),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('card_id'),
- sa.UniqueConstraint('img_path')
- )
- op.create_table('character_card',
- sa.Column('id', sa.Integer(), nullable=False),
- sa.Column('card_id', sa.Integer(), nullable=True),
- sa.Column('name', sa.String(length=100), nullable=True),
- sa.Column('age', sa.Integer(), nullable=True),
- sa.Column('role', sa.String(length=100), nullable=True),
- sa.Column('interest', sa.String(length=300), nullable=True),
- sa.Column('quote', sa.String(length=300), nullable=True),
- sa.Column('img_path', sa.String(length=300), nullable=False),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('card_id'),
- sa.UniqueConstraint('img_path')
- )
- op.create_table('goal_card',
- sa.Column('id', sa.Integer(), nullable=False),
- sa.Column('card_id', sa.Integer(), nullable=True),
- sa.Column('goal', sa.String(length=500), nullable=True),
- sa.Column('img_path', sa.String(length=300), nullable=False),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('card_id'),
- sa.UniqueConstraint('img_path')
- )
- op.create_table('PlayerActionCard',
- sa.Column('player', sa.Integer(), nullable=False),
- sa.Column('action_card', sa.Integer(), nullable=False),
- sa.ForeignKeyConstraint(['action_card'], ['action_card.card_id'], ),
- sa.ForeignKeyConstraint(['player'], ['player.id'], ),
- sa.PrimaryKeyConstraint('player', 'action_card')
- )
- with op.batch_alter_table('player', schema=None) as batch_op:
- batch_op.add_column(sa.Column('goal_card_id', sa.Integer(), nullable=True))
- batch_op.add_column(sa.Column('character_card_id', sa.Integer(), nullable=True))
- batch_op.create_foreign_key(None, 'goal_card', ['goal_card_id'], ['card_id'])
- batch_op.create_foreign_key(None, 'character_card', ['character_card_id'], ['card_id'])
- batch_op.drop_column('goal_card')
- batch_op.drop_column('character_card')
- # ### end Alembic commands ###
- def downgrade():
- # ### commands auto generated by Alembic - please adjust! ###
- with op.batch_alter_table('player', schema=None) as batch_op:
- batch_op.add_column(sa.Column('character_card', sa.INTEGER(), autoincrement=False, nullable=True))
- batch_op.add_column(sa.Column('goal_card', sa.INTEGER(), autoincrement=False, nullable=True))
- batch_op.drop_constraint(None, type_='foreignkey')
- batch_op.drop_constraint(None, type_='foreignkey')
- batch_op.drop_column('character_card_id')
- batch_op.drop_column('goal_card_id')
- op.drop_table('PlayerActionCard')
- op.drop_table('goal_card')
- op.drop_table('character_card')
- op.drop_table('action_card')
- # ### end Alembic commands ###
|