"""rty

Revision ID: 65e0be0aea04
Revises: 8c4538de9ef4
Create Date: 2019-01-15 16:44:00.716908

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

# revision identifiers, used by Alembic.
revision = '65e0be0aea04'
down_revision = '8c4538de9ef4'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('supplier', sa.Column('bank', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('bik', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('driver_director', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('fact_address', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('inn', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('kc', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('kpp', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('legal_add', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('llc', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('llc_name', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('ogrn', sa.String(length=240), nullable=True))
    op.add_column('supplier', sa.Column('rc', sa.String(length=240), nullable=True))
    op.drop_index('name', table_name='supplier')
    op.drop_constraint('supplier_ibfk_1', 'supplier', type_='foreignkey')
    op.drop_column('supplier', 'phone')
    op.drop_column('supplier', 'payment_day')
    op.drop_column('supplier', 'payment_terms')
    op.drop_column('supplier', 'user_id')
    op.drop_column('supplier', 'name')
    op.drop_column('supplier', 'supplier_base')
    op.drop_column('supplier', 'date_creation')
    op.drop_column('supplier', 'email')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('supplier', sa.Column('email', mysql.VARCHAR(length=240), nullable=True))
    op.add_column('supplier', sa.Column('date_creation', mysql.DATETIME(), nullable=True))
    op.add_column('supplier', sa.Column('supplier_base', mysql.VARCHAR(length=240), nullable=True))
    op.add_column('supplier', sa.Column('name', mysql.VARCHAR(length=240), nullable=True))
    op.add_column('supplier', sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('supplier', sa.Column('payment_terms', mysql.VARCHAR(length=240), nullable=True))
    op.add_column('supplier', sa.Column('payment_day', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('supplier', sa.Column('phone', mysql.VARCHAR(length=240), nullable=True))
    op.create_foreign_key('supplier_ibfk_1', 'supplier', 'user', ['user_id'], ['id'])
    op.create_index('name', 'supplier', ['name'], unique=True)
    op.drop_column('supplier', 'rc')
    op.drop_column('supplier', 'ogrn')
    op.drop_column('supplier', 'llc_name')
    op.drop_column('supplier', 'llc')
    op.drop_column('supplier', 'legal_add')
    op.drop_column('supplier', 'kpp')
    op.drop_column('supplier', 'kc')
    op.drop_column('supplier', 'inn')
    op.drop_column('supplier', 'fact_address')
    op.drop_column('supplier', 'driver_director')
    op.drop_column('supplier', 'bik')
    op.drop_column('supplier', 'bank')
    # ### end Alembic commands ###
