"""empty message

Revision ID: 9ef67415dda2
Revises: a05b0f3d301f
Create Date: 2019-01-11 10:00:45.902428

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

# revision identifiers, used by Alembic.
revision = '9ef67415dda2'
down_revision = 'a05b0f3d301f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('activity_categories',
    sa.Column('activity_id', sa.Integer(), nullable=False),
    sa.Column('category_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
    sa.ForeignKeyConstraint(['category_id'], ['categories.id'], ),
    sa.PrimaryKeyConstraint('activity_id', 'category_id')
    )
    op.drop_constraint('activities_ibfk_1', 'activities', type_='foreignkey')
    op.drop_column('activities', 'category_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('activities', sa.Column('category_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.create_foreign_key('activities_ibfk_1', 'activities', 'categories', ['category_id'], ['id'])
    op.drop_table('activity_categories')
    # ### end Alembic commands ###
