diff --git a/corepos/db/model.py b/corepos/db/model.py index 02aa313..318ea45 100644 --- a/corepos/db/model.py +++ b/corepos/db/model.py @@ -332,11 +332,11 @@ class MemberType(Base): """ __tablename__ = 'memtype' - memtype = sa.Column(sa.SmallInteger(), primary_key=True, nullable=False, default=0) + id = sa.Column('memtype', sa.SmallInteger(), primary_key=True, nullable=False, default=0) - memDesc = sa.Column(sa.String(length=20), nullable=True) + description = sa.Column('memDesc', sa.String(length=20), nullable=True) - custdataType = sa.Column(sa.String(length=10), nullable=True) + customer_type = sa.Column('custdataType', sa.String(length=10), nullable=True) discount = sa.Column(sa.SmallInteger(), nullable=True) @@ -344,10 +344,12 @@ class MemberType(Base): ssi = sa.Column(sa.Boolean(), nullable=True) - salesCode = sa.Column(sa.Integer(), nullable=True) + # TODO: this was apparently added "recently" - isn't present in all DBs + # (need to figure out how to conditionally include it in model?) + # sales_code = sa.Column('salesCode', sa.Integer(), nullable=True) def __str__(self): - return self.memDesc or "" + return self.description or "" class Customer(Base): @@ -404,7 +406,7 @@ class Customer(Base): member_type = orm.relationship( MemberType, - primaryjoin=MemberType.memtype == memType, + primaryjoin=MemberType.id == memType, foreign_keys=[memType], doc=""" Reference to the :class:`MemberType` to which this member belongs.