Add ProductCost.discontinued flag to schema
				
					
				
			This commit is contained in:
		
							parent
							
								
									f230b379c4
								
							
						
					
					
						commit
						3d1154b5a9
					
				
					 2 changed files with 38 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
# -*- coding: utf-8 -*-
 | 
			
		||||
"""add productcost.discontinued
 | 
			
		||||
 | 
			
		||||
Revision ID: 6a1ec8b93637
 | 
			
		||||
Revises: 3b5e0b87c176
 | 
			
		||||
Create Date: 2017-03-28 18:02:44.714003
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from __future__ import unicode_literals
 | 
			
		||||
 | 
			
		||||
# revision identifiers, used by Alembic.
 | 
			
		||||
revision = '6a1ec8b93637'
 | 
			
		||||
down_revision = u'3b5e0b87c176'
 | 
			
		||||
branch_labels = None
 | 
			
		||||
depends_on = None
 | 
			
		||||
 | 
			
		||||
from alembic import op
 | 
			
		||||
import sqlalchemy as sa
 | 
			
		||||
import rattail.db.types
 | 
			
		||||
from sqlalchemy.dialects import postgresql
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def upgrade():
 | 
			
		||||
 | 
			
		||||
    # product_cost
 | 
			
		||||
    op.add_column('product_cost', sa.Column('discontinued', sa.Boolean(), nullable=True))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def downgrade():
 | 
			
		||||
 | 
			
		||||
    # product_cost
 | 
			
		||||
    op.drop_column('product_cost', 'discontinued')
 | 
			
		||||
| 
						 | 
				
			
			@ -466,6 +466,11 @@ class ProductCost(Base):
 | 
			
		|||
    unit_cost = sa.Column(sa.Numeric(precision=9, scale=5))
 | 
			
		||||
    effective = sa.Column(sa.DateTime())
 | 
			
		||||
 | 
			
		||||
    discontinued = sa.Column(sa.Boolean(), nullable=True, doc="""
 | 
			
		||||
    Flag to indicate if the cost record has been discontinued, presumably by
 | 
			
		||||
    the vendor.
 | 
			
		||||
    """)
 | 
			
		||||
 | 
			
		||||
    vendor = orm.relationship(
 | 
			
		||||
        Vendor,
 | 
			
		||||
        backref=orm.backref('product_costs', cascade='all'))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue