"""empty message

Revision ID: afc770e21692
Revises: 054b117cc948
Create Date: 2020-03-07 01:35:32.113078

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

# revision identifiers, used by Alembic.
revision = 'afc770e21692'
down_revision = '054b117cc948'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('products',
    sa.Column('id', sa.Integer(), nullable=True),
    sa.Column('prod_name', sa.String(length=250), nullable=False),
    sa.Column('amz_asin', sa.String(length=25), nullable=False),
    sa.Column('last_price', sa.Integer(), nullable=False),
    sa.Column('upc', sa.String(length=25), nullable=False),
    sa.Column('description', sa.String(length=250), nullable=False),
    sa.Column('keywords', sa.String(length=250), nullable=False),
    sa.Column('categories', sa.String(length=250), nullable=False),
    sa.Column('fba', sa.Boolean(), nullable=True),
    sa.Column('prohibited', sa.Boolean(), nullable=True),
    sa.Column('ship_weight', sa.Integer(), nullable=False),
    sa.Column('ocean_dimension', sa.Integer(), nullable=False),
    sa.Column('air_dimension', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('amz_asin'),
    sa.UniqueConstraint('id')
    )
    op.add_column('cart', sa.Column('order_id', sa.Integer(), nullable=True))
    op.add_column('cart', sa.Column('ship_method', sa.String(length=25), nullable=False))
    op.drop_index('order_temp_id', table_name='cart')
    op.create_unique_constraint(None, 'cart', ['order_id'])
    op.drop_column('cart', 'order_temp_id')
    op.drop_column('customer', 'cod_lib')
    op.drop_column('customer', 'phone')
    op.add_column('queries', sa.Column('customer_id', sa.String(length=25), nullable=False))
    op.drop_index('session_id', table_name='queries')
    op.drop_column('queries', 'fba')
    op.drop_column('queries', 'description')
    op.drop_column('queries', 'ocean_dimension')
    op.drop_column('queries', 'categories')
    op.drop_column('queries', 'last_added_date')
    op.drop_column('queries', 'prohibited')
    op.drop_column('queries', 'product')
    op.drop_column('queries', 'air_dimension')
    op.drop_column('queries', 'ship_weight')
    op.drop_column('queries', 'added_cart')
    op.drop_column('queries', 'session_id')
    op.drop_column('queries', 'keywords')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('queries', sa.Column('keywords', mysql.VARCHAR(length=250), nullable=False))
    op.add_column('queries', sa.Column('session_id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False))
    op.add_column('queries', sa.Column('added_cart', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('queries', sa.Column('ship_weight', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
    op.add_column('queries', sa.Column('air_dimension', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
    op.add_column('queries', sa.Column('product', mysql.VARCHAR(length=250), nullable=False))
    op.add_column('queries', sa.Column('prohibited', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('queries', sa.Column('last_added_date', mysql.DATETIME(), nullable=False))
    op.add_column('queries', sa.Column('categories', mysql.VARCHAR(length=250), nullable=False))
    op.add_column('queries', sa.Column('ocean_dimension', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
    op.add_column('queries', sa.Column('description', mysql.VARCHAR(length=250), nullable=False))
    op.add_column('queries', sa.Column('fba', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.create_index('session_id', 'queries', ['session_id'], unique=True)
    op.drop_column('queries', 'customer_id')
    op.add_column('customer', sa.Column('phone', mysql.VARCHAR(length=15), nullable=True))
    op.add_column('customer', sa.Column('cod_lib', mysql.VARCHAR(length=15), nullable=True))
    op.add_column('cart', sa.Column('order_temp_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'cart', type_='unique')
    op.create_index('order_temp_id', 'cart', ['order_temp_id'], unique=True)
    op.drop_column('cart', 'ship_method')
    op.drop_column('cart', 'order_id')
    op.drop_table('products')
    # ### end Alembic commands ###
