availabili.tf/backend/migrations/versions/204aa692d35c_rename_playerr...

49 lines
1.9 KiB
Python

"""Rename playerrole to playerroles
Revision ID: 204aa692d35c
Revises: c23b1c32e89a
Create Date: 2024-10-23 15:57:01.483040
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '204aa692d35c'
down_revision: Union[str, None] = 'c23b1c32e89a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('playerroles',
sa.Column('playerinfo_id', sa.BigInteger(), nullable=False),
sa.Column('team_id', sa.Integer(), nullable=False),
sa.Column('class_role', sa.Enum('P_SCOUT', 'F_SCOUT', 'SCOUT', 'P_SOLLY', 'ROAMER', 'SOLDIER', 'PYRO', 'DEMO', 'HEAVY', 'ENGIE', 'MEDIC', 'SNIPER', 'SPY', name='classrole'), nullable=False),
sa.Column('main', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['playerinfo_id'], ['playerinfo_teams.playerinfo_id'], ),
sa.ForeignKeyConstraint(['team_id'], ['playerinfo_teams.team_id'], ),
sa.PrimaryKeyConstraint('playerinfo_id', 'team_id', 'class_role')
)
op.drop_table('playerrole')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('playerrole',
sa.Column('playerinfo_id', sa.BIGINT(), nullable=False),
sa.Column('team_id', sa.INTEGER(), nullable=False),
sa.Column('class_role', sa.VARCHAR(length=7), nullable=False),
sa.Column('main', sa.BOOLEAN(), nullable=True),
sa.ForeignKeyConstraint(['playerinfo_id'], ['playerinfo_teams.playerinfo_id'], ),
sa.ForeignKeyConstraint(['team_id'], ['playerinfo_teams.team_id'], ),
sa.PrimaryKeyConstraint('playerinfo_id', 'team_id', 'class_role')
)
op.drop_table('playerroles')
# ### end Alembic commands ###