From ad23c489893e936ea9d2d478949ac7a08042e0fb Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Thu, 27 Mar 2025 21:23:29 +0000 Subject: [PATCH] Add migration for Glory --- .../20250327_212310_6d9c1171_create_glory.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 alembic/versions/20250327_212310_6d9c1171_create_glory.py diff --git a/alembic/versions/20250327_212310_6d9c1171_create_glory.py b/alembic/versions/20250327_212310_6d9c1171_create_glory.py new file mode 100644 index 0000000..cdae291 --- /dev/null +++ b/alembic/versions/20250327_212310_6d9c1171_create_glory.py @@ -0,0 +1,46 @@ +"""create glorys table + +Revision ID: a2b3c4d5e6f7 +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 = 'a2b3c4d5e6f7' +down_revision = None +branch_labels = None +depends_on = None + +def upgrade(): + op.create_table( + 'glorys', + 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('league', sa.String(), nullable=False), + sa.Column('points', sa.Integer(), default=0), + sa.Column('matches_played', sa.Integer(), default=0), + sa.Column('wins', sa.Integer(), default=0), + sa.Column('draws', sa.Integer(), default=0), + sa.Column('losses', sa.Integer(), default=0), + sa.Column('goals_for', sa.Integer(), default=0), + sa.Column('goals_against', sa.Integer(), default=0), + sa.Column('goal_difference', sa.Integer(), default=0), + sa.Column('position', sa.Integer()), + sa.Column('is_active', sa.Boolean(), default=True), + sa.Column('season', sa.String(), nullable=False), + sa.Column('coach', sa.String()), + sa.Column('home_stadium', 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_glorys_team_name', 'glorys', ['team_name']) + +def downgrade(): + op.drop_index('ix_glorys_team_name', 'glorys') + op.drop_table('glorys') \ No newline at end of file