"""empty message

Revision ID: a04b2ac81210
Revises: 21830c5b874c
Create Date: 2020-11-16 08:08:06.810394

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a04b2ac81210'
down_revision = '21830c5b874c'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tblpullout',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('series', sa.Integer(), nullable=True),
    sa.Column('seriescode', sa.String(length=50), nullable=False),
    sa.Column('transnumber', sa.Integer(), nullable=False),
    sa.Column('objtype', sa.Integer(), nullable=False),
    sa.Column('transdate', sa.DateTime(), nullable=False),
    sa.Column('reference', sa.String(length=100), nullable=False),
    sa.Column('remarks', sa.String(length=250), nullable=True),
    sa.Column('docstatus', sa.String(length=10), nullable=False),
    sa.Column('sap_number', sa.Integer(), nullable=True),
    sa.Column('created_by', sa.Integer(), nullable=True),
    sa.Column('updated_by', sa.Integer(), nullable=True),
    sa.Column('date_created', sa.DateTime(), nullable=False),
    sa.Column('date_updated', sa.DateTime(), nullable=False),
    sa.Column('confirm', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['created_by'], ['tbluser.id'], ),
    sa.ForeignKeyConstraint(['objtype'], ['tblobjtype.objtype'], ),
    sa.ForeignKeyConstraint(['series'], ['tblseries.id'], onupdate='NO ACTION', ondelete='NO ACTION'),
    sa.ForeignKeyConstraint(['updated_by'], ['tbluser.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('tblpulloutrow',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pullout_id', sa.Integer(), nullable=False),
    sa.Column('whsecode', sa.String(length=100), nullable=False),
    sa.Column('item_code', sa.String(length=100), nullable=True),
    sa.Column('objtype', sa.Integer(), nullable=False),
    sa.Column('quantity', sa.Float(), nullable=False),
    sa.Column('uom', sa.String(length=50), nullable=True),
    sa.Column('created_by', sa.Integer(), nullable=True),
    sa.Column('updated_by', sa.Integer(), nullable=True),
    sa.Column('date_created', sa.DateTime(), nullable=False),
    sa.Column('date_updated', sa.DateTime(), nullable=False),
    sa.Column('sap_number', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['created_by'], ['tbluser.id'], ),
    sa.ForeignKeyConstraint(['item_code'], ['tblitems.item_code'], ),
    sa.ForeignKeyConstraint(['pullout_id'], ['tblpullout.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['uom'], ['tbluom.code'], ),
    sa.ForeignKeyConstraint(['updated_by'], ['tbluser.id'], ),
    sa.ForeignKeyConstraint(['whsecode'], ['tblwhses.whsecode'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.alter_column('tblitems', 'price',
               existing_type=sa.FLOAT(precision=53),
               nullable=True)
    op.add_column('tbluser', sa.Column('isAllowPullOut', sa.Boolean(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('tbluser', 'isAllowPullOut')
    op.alter_column('tblitems', 'price',
               existing_type=sa.FLOAT(precision=53),
               nullable=False)
    op.drop_table('tblpulloutrow')
    op.drop_table('tblpullout')
    # ### end Alembic commands ###
