"""empty message

Revision ID: 68d12179f67e
Revises: b4676b756a49
Create Date: 2020-11-06 15:22:47.759330

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '68d12179f67e'
down_revision = 'b4676b756a49'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tblpricelistrow',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pricelist_id', sa.Integer(), nullable=False),
    sa.Column('item_code', sa.Integer(), nullable=False),
    sa.Column('price', sa.Float(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=False),
    sa.Column('date_updated', sa.DateTime(), nullable=False),
    sa.Column('created_by', sa.Integer(), nullable=False),
    sa.Column('updated_by', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['created_by'], ['tbluser.id'], ondelete='NO ACTION'),
    sa.ForeignKeyConstraint(['item_code'], ['tblitems.id'], ondelete='NO ACTION'),
    sa.ForeignKeyConstraint(['pricelist_id'], ['tblpricelist.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['updated_by'], ['tbluser.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_constraint('FK__tblpricel__item___3508D0F3', 'tblpricelist', type_='foreignkey')
    op.drop_column('tblpricelist', 'price')
    op.drop_column('tblpricelist', 'item_code')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('tblpricelist', sa.Column('item_code', sa.INTEGER(), autoincrement=False, nullable=False))
    op.add_column('tblpricelist', sa.Column('price', sa.FLOAT(precision=53), autoincrement=False, nullable=False))
    op.create_foreign_key('FK__tblpricel__item___3508D0F3', 'tblpricelist', 'tblitems', ['item_code'], ['id'])
    op.drop_table('tblpricelistrow')
    # ### end Alembic commands ###
