"""empty message

Revision ID: 45f8da7eae76
Revises: 3c706c57fa0
Create Date: 2015-12-12 10:45:36.131728

"""

# revision identifiers, used by Alembic.
revision = '45f8da7eae76'
down_revision = '3c706c57fa0'

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('coupon', sa.Column('cat_id', sa.Integer(), nullable=True))
    op.add_column('coupon', sa.Column('coupon_cat', mysql.TINYINT(display_width=1), nullable=False))
    op.create_foreign_key(None, 'coupon', 'item_cat', ['cat_id'], ['id'])
    op.drop_column('coupon', 'cat')
    op.add_column('user_coupon', sa.Column('cat_id', sa.Integer(), nullable=True))
    op.add_column('user_coupon', sa.Column('coupon_cat', mysql.TINYINT(display_width=1), nullable=False))
    op.create_foreign_key(None, 'user_coupon', 'item_cat', ['cat_id'], ['id'])
    op.drop_column('user_coupon', 'cat')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user_coupon', sa.Column('cat', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'user_coupon', type_='foreignkey')
    op.drop_column('user_coupon', 'coupon_cat')
    op.drop_column('user_coupon', 'cat_id')
    op.add_column('coupon', sa.Column('cat', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'coupon', type_='foreignkey')
    op.drop_column('coupon', 'coupon_cat')
    op.drop_column('coupon', 'cat_id')
    ### end Alembic commands ###
