Add migration for Football
This commit is contained in:
parent
bf84d419d8
commit
daee6f4b64
37
alembic/versions/20250326_124400_41915c47_create_football.py
Normal file
37
alembic/versions/20250326_124400_41915c47_create_football.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
"""create footballs table
|
||||||
|
|
||||||
|
Revision ID: b2c3d4e5f6g7
|
||||||
|
Revises:
|
||||||
|
Create Date: 2024-01-09 10:00:00.000000
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
# revision identifiers
|
||||||
|
revision = 'b2c3d4e5f6g7'
|
||||||
|
down_revision = None
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'footballs',
|
||||||
|
sa.Column('id', sa.String(), primary_key=True, default=lambda: str(uuid.uuid4())),
|
||||||
|
sa.Column('team_name', sa.String(), nullable=False, index=True),
|
||||||
|
sa.Column('player_count', sa.Integer(), default=11),
|
||||||
|
sa.Column('league', sa.String(), nullable=False),
|
||||||
|
sa.Column('is_active', sa.Boolean(), default=True),
|
||||||
|
sa.Column('team_ranking', sa.Integer()),
|
||||||
|
sa.Column('stadium_name', sa.String()),
|
||||||
|
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
|
||||||
|
sa.Column('updated_at', sa.DateTime(), server_default=sa.func.now(), onupdate=sa.func.now()),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
|
||||||
|
op.create_index('ix_footballs_team_name', 'footballs', ['team_name'])
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_index('ix_footballs_team_name', 'footballs')
|
||||||
|
op.drop_table('footballs')
|
Loading…
x
Reference in New Issue
Block a user