<filename>psi/migrations/versions/35_a173601e2e8c_.py<gh_stars>10-100
""" Add inventory in and inventory out link to calculate profit using FIFO method

Revision ID: <KEY>
Revises: 5fa54f2ce13c
Create Date: 2017-03-29 07:06:57.758959

"""

# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '5fa54f2ce13c'

from alembic import op
import sqlalchemy as sa


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('inventory_in_out_link',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date', sa.DateTime(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=False),
    sa.Column('in_price', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=False),
    sa.Column('in_date', sa.DateTime(), nullable=False),
    sa.Column('receiving_line_id', sa.Integer(), nullable=False),
    sa.Column('out_price', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=False),
    sa.Column('out_date', sa.DateTime(), nullable=False),
    sa.Column('out_quantity', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=False),
    sa.Column('shipping_line_id', sa.Integer(), nullable=False),
    sa.Column('organization_id', sa.Integer(), nullable=True),
    sa.Column('remark', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['organization_id'], ['organization.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.ForeignKeyConstraint(['receiving_line_id'], ['receiving_line.id'], ),
    sa.ForeignKeyConstraint(['shipping_line_id'], ['shipping_line.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column(u'inventory_transaction_line', sa.Column('saleable_quantity', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'inventory_transaction_line', 'saleable_quantity')
    op.drop_table('inventory_in_out_link')
    # ### end Alembic commands ###

<filename>psi/migrations/versions/35_a173601e2e8c_.py<gh_stars>10-100
""" Add inventory in and inventory out link to calculate profit using FIFO method

Revision ID: <KEY>
Revises: 5fa54f2ce13c
Create Date: 2017-03-29 07:06:57.758959

"""

# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '5fa54f2ce13c'

from alembic import op
import sqlalchemy as sa


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('inventory_in_out_link',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date', sa.DateTime(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=False),
    sa.Column('in_price', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=False),
    sa.Column('in_date', sa.DateTime(), nullable=False),
    sa.Column('receiving_line_id', sa.Integer(), nullable=False),
    sa.Column('out_price', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=False),
    sa.Column('out_date', sa.DateTime(), nullable=False),
    sa.Column('out_quantity', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=False),
    sa.Column('shipping_line_id', sa.Integer(), nullable=False),
    sa.Column('organization_id', sa.Integer(), nullable=True),
    sa.Column('remark', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['organization_id'], ['organization.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.ForeignKeyConstraint(['receiving_line_id'], ['receiving_line.id'], ),
    sa.ForeignKeyConstraint(['shipping_line_id'], ['shipping_line.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column(u'inventory_transaction_line', sa.Column('saleable_quantity', sa.Numeric(precision=8, scale=2, decimal_return_scale=2), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'inventory_transaction_line', 'saleable_quantity')
    op.drop_table('inventory_in_out_link')
    # ### end Alembic commands ###

Add inventory in and inventory out link to calculate profit using FIFO method  Revision ID: <KEY> Revises: 5fa54f2ce13c Create Date: 2017-03-29 07:06:57.758959 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###