From 0e3030394796b39117a2c5d9671188b9bc3db6ad Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 7 Sep 2023 17:45:14 -0500 Subject: [PATCH] Tweak primary key for StockPurchase model per having a better understanding now, i think.. --- corepos/db/office_trans/model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/corepos/db/office_trans/model.py b/corepos/db/office_trans/model.py index d484b4b..b203240 100644 --- a/corepos/db/office_trans/model.py +++ b/corepos/db/office_trans/model.py @@ -32,7 +32,8 @@ Base = orm.declarative_base() # TODO: not sure what primary key should be for this? am trying a -# composite one so far, we'll see... +# composite one so far, we'll see...cf. also andy's comments in +# https://github.com/CORE-POS/IS4C/pull/1189#issuecomment-1597481138 class StockPurchase(Base): """ Represents a member equity payment. @@ -43,13 +44,13 @@ class StockPurchase(Base): amount = sa.Column('stockPurchase', sa.Numeric(precision=10, scale=2), nullable=True) - datetime = sa.Column('tdate', sa.DateTime(), nullable=True, primary_key=True) + datetime = sa.Column('tdate', sa.DateTime(), nullable=True, primary_key=True, autoincrement=False) transaction_number = sa.Column('trans_num', sa.String(length=50), nullable=True, primary_key=True) transaction_id = sa.Column('trans_id', sa.Integer(), nullable=True) - department_number = sa.Column('dept', sa.Integer(), nullable=True) + department_number = sa.Column('dept', sa.Integer(), nullable=True, primary_key=True, autoincrement=False) def __str__(self): return f"#{self.card_number} for ${self.amount}"