"""Fixup playdates relationship

Revision ID: 269a002f989d
Revises: 9bf80ba3635f
Create Date: 2021-03-28 14:36:59.103846

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '269a002f989d'
down_revision = '9bf80ba3635f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('playdates', sa.Column('track_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'playdates', 'tracks', ['track_id'], ['id'])
    op.drop_constraint('tracks_ibfk_1', 'tracks', type_='foreignkey')
    op.drop_column('tracks', 'playdates_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('tracks', sa.Column('playdates_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.create_foreign_key('tracks_ibfk_1', 'tracks', 'playdates', ['playdates_id'], ['id'])
    op.drop_constraint(None, 'playdates', type_='foreignkey')
    op.drop_column('playdates', 'track_id')
    # ### end Alembic commands ###
