06/03 Optimize codes, Schwab account
This commit is contained in:
@@ -6,6 +6,9 @@ class Investment(db.Model):
|
||||
__tablename__ = 'investments'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
# Optional link to a PFM account (e.g. Schwab Individual, Schwab Roth IRA).
|
||||
# NULL means the holding is not tied to a specific account.
|
||||
account_id = db.Column(db.Integer, db.ForeignKey('accounts.id'), nullable=True, index=True)
|
||||
asset_name = db.Column(db.String(100), nullable=False)
|
||||
ticker = db.Column(db.String(20), nullable=True)
|
||||
asset_type = db.Column(
|
||||
@@ -22,6 +25,7 @@ class Investment(db.Model):
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
account = db.relationship('Account', foreign_keys=[account_id])
|
||||
inv_transactions = db.relationship('InvestmentTransaction', back_populates='investment',
|
||||
lazy='dynamic', cascade='all, delete-orphan')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user