availabili.tf/backend-flask/migrations/versions/7361c978e53d_fix_integrity.py

41 lines
1.3 KiB
Python

"""Fix integrity
Revision ID: 7361c978e53d
Revises: 6e9d70f835d7
Create Date: 2024-11-21 12:43:01.786598
"""
from alembic import op
import sqlalchemy as sa
import app_db
# revision identifiers, used by Alembic.
revision = '7361c978e53d'
down_revision = '6e9d70f835d7'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('players_teams_availability', schema=None, naming_convention=app_db.convention) as batch_op:
batch_op.create_foreign_key(batch_op.f("fk_players_teams_availability_player_team_id_players_teams"), 'players_teams', ['player_team_id'], ['id'])
with op.batch_alter_table('players_teams_roles', schema=None) as batch_op:
batch_op.create_foreign_key(batch_op.f("fk_players_teams_roles_player_team_id_players_teams"), 'players_teams', ['player_team_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('players_teams_roles', schema=None, naming_convention=app_db.convention) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
with op.batch_alter_table('players_teams_availability', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
# ### end Alembic commands ###