fix: add workaround to avoid missing schema columns
more columns will need to be added to this workaround i'm sure, but this takes care of a couple small ones
This commit is contained in:
parent
b8ca60b508
commit
7aaa35dac7
|
@ -1039,11 +1039,10 @@ class MemberType(Base):
|
||||||
|
|
||||||
ssi = sa.Column(sa.Boolean(), nullable=True)
|
ssi = sa.Column(sa.Boolean(), nullable=True)
|
||||||
|
|
||||||
ignoreSales = sa.Column(sa.Boolean(), nullable=True, default=False)
|
# nb. this must be added explicitly if DB is new enough
|
||||||
ignore_sales = orm.synonym('ignoreSales')
|
#ignore_sales = sa.Column('ignoreSales', sa.Boolean(), nullable=True, default=False)
|
||||||
|
|
||||||
# TODO: this was apparently added "recently" - isn't present in all DBs
|
# nb. this must be added explicitly if DB is new enough
|
||||||
# (need to figure out how to conditionally include it in model?)
|
|
||||||
#sales_code = sa.Column('salesCode', sa.Integer(), nullable=True)
|
#sales_code = sa.Column('salesCode', sa.Integer(), nullable=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -1842,3 +1841,22 @@ class PurchaseOrderNote(Base):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.notes or ""
|
return self.notes or ""
|
||||||
|
|
||||||
|
|
||||||
|
# the rest of this is a workaround to deal with the fact that some
|
||||||
|
# CORE databases have columns which others do not. i had assumed that
|
||||||
|
# all would be more or less the same but not so in practice. so if
|
||||||
|
# your DB *does* have these columns, you must invoke the function
|
||||||
|
# below in order to merge them into your schema. you should do this
|
||||||
|
# on app startup and they'll be available normally from then on.
|
||||||
|
|
||||||
|
RUNTIME = {'added_latest_columns': False}
|
||||||
|
|
||||||
|
def use_latest_columns():
|
||||||
|
if RUNTIME['added_latest_columns']:
|
||||||
|
return
|
||||||
|
|
||||||
|
MemberType.ignore_sales = sa.Column('ignoreSales', sa.Boolean(), nullable=True, default=False)
|
||||||
|
MemberType.sales_code = sa.Column('salesCode', sa.Integer(), nullable=True)
|
||||||
|
|
||||||
|
RUNTIME['added_latest_columns'] = True
|
||||||
|
|
Loading…
Reference in a new issue