"""supplier

Revision ID: 8c4538de9ef4
Revises: 55ce5224d87b
Create Date: 2019-01-15 15:09:52.236107

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('supplier',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=240), nullable=True),
    sa.Column('phone', sa.String(length=240), nullable=True),
    sa.Column('email', sa.String(length=240), nullable=True),
    sa.Column('payment_day', sa.Integer(), nullable=True),
    sa.Column('payment_terms', sa.String(length=240), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('date_creation', sa.DateTime(), nullable=True),
    sa.Column('supplier_base', sa.String(length=240), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('agreement_supplier',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('creation', sa.DateTime(), nullable=True),
    sa.Column('date', sa.String(length=120), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('date_agreement', sa.DateTime(), nullable=True),
    sa.Column('filename', sa.String(length=120), nullable=True),
    sa.Column('supplier_id', sa.Integer(), nullable=True),
    sa.Column('supplier_name', sa.String(length=240), nullable=True),
    sa.Column('number', sa.String(length=240), nullable=True),
    sa.Column('choice', sa.String(length=240), nullable=True),
    sa.Column('count', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['supplier_id'], ['supplier.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('count'),
    sa.UniqueConstraint('supplier_name')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('agreement_supplier')
    op.drop_table('supplier')
    # ### end Alembic commands ###
