diff --git a/backend-flask/migrations/versions/5debac4cdf37_add_events.py b/backend-flask/migrations/versions/5debac4cdf37_add_events.py new file mode 100644 index 0000000..4d2403a --- /dev/null +++ b/backend-flask/migrations/versions/5debac4cdf37_add_events.py @@ -0,0 +1,46 @@ +"""Add Events + +Revision ID: 5debac4cdf37 +Revises: 131efbdd7af4 +Create Date: 2024-11-20 15:17:00.205485 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utc + + +# revision identifiers, used by Alembic. +revision = '5debac4cdf37' +down_revision = '131efbdd7af4' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('events', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('name', sa.String(length=255), nullable=False), + sa.Column('description', sa.Text(), nullable=True), + sa.Column('start_time', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), nullable=False), + sa.Column('team_id', sa.Integer(), nullable=False), + sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), + sa.ForeignKeyConstraint(['team_id'], ['teams.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('players_events', + sa.Column('event_id', sa.Integer(), nullable=False), + sa.Column('player_id', sa.BigInteger(), nullable=False), + sa.ForeignKeyConstraint(['event_id'], ['events.id'], ), + sa.ForeignKeyConstraint(['player_id'], ['players.steam_id'], ), + sa.PrimaryKeyConstraint('event_id', 'player_id') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('players_events') + op.drop_table('events') + # ### end Alembic commands ###