"""empty message

Revision ID: bf7e27e63ad6
Revises: 37a902302f58
Create Date: 2020-01-16 18:18:37.117370

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

# revision identifiers, used by Alembic.
revision = 'bf7e27e63ad6'
down_revision = '37a902302f58'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('Shipping')
    op.drop_table('Payment')
    op.add_column('Order', sa.Column('payment', sa.String(length=50), nullable=True))
    op.add_column('Order', sa.Column('shipping', sa.String(length=50), nullable=True))
    op.drop_constraint('Order_ibfk_2', 'Order', type_='foreignkey')
    op.drop_constraint('Order_ibfk_3', 'Order', type_='foreignkey')
    op.drop_column('Order', 'shipping_id')
    op.drop_column('Order', 'payment_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('Order', sa.Column('payment_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('Order', sa.Column('shipping_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.create_foreign_key('Order_ibfk_3', 'Order', 'Payment', ['payment_id'], ['id'], ondelete='SET NULL')
    op.create_foreign_key('Order_ibfk_2', 'Order', 'Shipping', ['shipping_id'], ['id'], ondelete='SET NULL')
    op.drop_column('Order', 'shipping')
    op.drop_column('Order', 'payment')
    op.create_table('Payment',
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('name', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('description', mysql.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='latin1',
    mysql_engine='InnoDB'
    )
    op.create_table('Shipping',
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('name', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('description', mysql.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='latin1',
    mysql_engine='InnoDB'
    )
    # ### end Alembic commands ###
