Changeset - d2e764f3888c
[Not reviewed]
0 1 0
Lance Edgar - 5 years ago 2019-07-23 10:55:42
ledgar@techsupport.coop
Rename attributes for MemberType data model

also, comment-out the "sales code" column for now, since it doesn't exist in
all production databases. (not sure how best to handle that yet)
1 file changed with 8 insertions and 6 deletions:
0 comments (0 inline, 0 general) First comment
corepos/db/model.py
Show inline comments
 
@@ -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.
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now