Skip to content

Commit e4c83b4

Browse files
committed
removing tx ides from accounts, this is unecessary and causing table issues
1 parent a0ab375 commit e4c83b4

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

donate/models.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ def __declare_last__(cls):
3737
"not a valid email address")
3838

3939

40+
# acct_tx_table = db.Table('association', db.Model.metadata,
41+
# db.Column('acct_id',
42+
# db.Integer,
43+
# db.ForeignKey('account.id')),
44+
# db.Column('tx_id',
45+
# db.Integer,
46+
# db.ForeignKey('transaction.id')))
47+
48+
4049
class Transaction(db.Model):
4150
''' A transaction moves amounts between accounts. When a transaction
4251
occurs, an account must be debited and an account must be credited.
@@ -70,6 +79,12 @@ class Transaction(db.Model):
7079
db.ForeignKey('user.id'),
7180
nullable=False)
7281

82+
# db.ForeignKeyConstraint(['payer_id'], ['account.id'],
83+
# use_alter=True, name='fk_acct_pay')
84+
85+
# db.ForeignKeyConstraint(['recvr_id'], ['account.id'],
86+
# use_alter=True, name='fk_acct_rec')
87+
7388
ccy = db.relationship('Currency')
7489
payer = db.relationship('Account', foreign_keys=[payer_id])
7590
recvr = db.relationship('Account', foreign_keys=[recvr_id])
@@ -93,20 +108,16 @@ class Account(db.Model):
93108
94109
id: unique Id
95110
name: name or nmenonic of account
96-
tx_ids: transactions associated with account. Must link to pay/rec to
97-
get debit or credit info
98111
ccy_id: account denomination e.g. USD or BTC.
99112
'''
100113

101114
id = db.Column(db.Integer, primary_key=True)
102115
name = db.Column(db.String(120), unique=True, nullable=False)
103-
tx_ids = db.Column(db.Integer, db.ForeignKey('transaction.id'))
104116
ccy_id = db.Column(db.Integer, db.ForeignKey('currency.id'))
105117

106118
@classmethod
107119
def __declare_last__(cls):
108120
ValidateString(Account.name, False, True)
109-
ValidateInteger(Account.tx_ids, False, True)
110121
ValidateInteger(Account.ccy_id, False, True)
111122

112123

tests/test_transactions.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
from donate.app import create_app
22
from donate.settings import TestConfig
33
from donate import models
4-
5-
6-
def test_insert_empty_tx():
7-
app = create_app(TestConfig)
8-
tx = models.Transaction()

0 commit comments

Comments
 (0)