Remove "default" values from Product model definition
i'm a bit torn about this. on the one hand i like there being some default values here, but realistically they didn't all make sense. also it could be said that default values amount to business logic and that should stay in CORE basically. but in the end, i needed these to go away in order to simplify generating some SQL INSERT statements. was using SQLAlchemy core and it kept insisting that all fields with a "default" defined should be part of the INSERT statement, but really i didn't want them to be. so they no longer have defaults.
This commit is contained in:
parent
9dd5813520
commit
29638c062c
|
@ -481,7 +481,10 @@ class Product(Base):
|
||||||
|
|
||||||
scale = sa.Column(sa.Boolean(), nullable=True)
|
scale = sa.Column(sa.Boolean(), nullable=True)
|
||||||
|
|
||||||
scale_price = sa.Column('scaleprice', sa.Boolean(), nullable=True, default=False)
|
# TODO: yikes, did i just code this all wrong the first time? pretty sure
|
||||||
|
# this needs to change to a decimal column...
|
||||||
|
scale_price = sa.Column('scaleprice', sa.Boolean(), nullable=True)
|
||||||
|
# scale_price = sa.Column('scaleprice', sa.Numeric(precision=10, scale=2), nullable=True)
|
||||||
|
|
||||||
mix_match_code = sa.Column('mixmatchcode', sa.String(length=13), nullable=True)
|
mix_match_code = sa.Column('mixmatchcode', sa.String(length=13), nullable=True)
|
||||||
|
|
||||||
|
@ -505,11 +508,11 @@ class Product(Base):
|
||||||
|
|
||||||
id_enforced = sa.Column('idEnforced', sa.SmallInteger(), nullable=True)
|
id_enforced = sa.Column('idEnforced', sa.SmallInteger(), nullable=True)
|
||||||
|
|
||||||
cost = sa.Column(sa.Float(), nullable=True, default=0)
|
cost = sa.Column(sa.Float(), nullable=True)
|
||||||
|
|
||||||
in_use = sa.Column('inUse', sa.Boolean(), nullable=True)
|
in_use = sa.Column('inUse', sa.Boolean(), nullable=True)
|
||||||
|
|
||||||
flags = sa.Column('numflag', sa.Integer(), nullable=True, default=0)
|
flags = sa.Column('numflag', sa.Integer(), nullable=True)
|
||||||
|
|
||||||
subdepartment_number = sa.Column('subdept', sa.SmallInteger(), nullable=True)
|
subdepartment_number = sa.Column('subdept', sa.SmallInteger(), nullable=True)
|
||||||
subdepartment = orm.relationship(
|
subdepartment = orm.relationship(
|
||||||
|
@ -522,11 +525,11 @@ class Product(Base):
|
||||||
|
|
||||||
deposit = sa.Column(sa.Float(), nullable=True)
|
deposit = sa.Column(sa.Float(), nullable=True)
|
||||||
|
|
||||||
local = sa.Column(sa.Integer(), nullable=True, default=0)
|
local = sa.Column(sa.Integer(), nullable=True)
|
||||||
|
|
||||||
store_id = sa.Column(sa.SmallInteger(), nullable=True, default=0)
|
store_id = sa.Column(sa.SmallInteger(), nullable=True)
|
||||||
|
|
||||||
default_vendor_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
default_vendor_id = sa.Column(sa.Integer(), nullable=True)
|
||||||
default_vendor = orm.relationship(
|
default_vendor = orm.relationship(
|
||||||
Vendor,
|
Vendor,
|
||||||
primaryjoin=Vendor.id == default_vendor_id,
|
primaryjoin=Vendor.id == default_vendor_id,
|
||||||
|
@ -537,7 +540,7 @@ class Product(Base):
|
||||||
# TODO: deprecate / remove this?
|
# TODO: deprecate / remove this?
|
||||||
vendor = orm.synonym('default_vendor')
|
vendor = orm.synonym('default_vendor')
|
||||||
|
|
||||||
current_origin_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
current_origin_id = sa.Column(sa.Integer(), nullable=True)
|
||||||
|
|
||||||
# TODO: some older DB's might not have this? guess we'll see
|
# TODO: some older DB's might not have this? guess we'll see
|
||||||
last_sold = sa.Column(sa.DateTime(), nullable=True)
|
last_sold = sa.Column(sa.DateTime(), nullable=True)
|
||||||
|
|
Loading…
Reference in a new issue