"""LedgerContractFlowthroughCurrentBalance model. Model for managing ledger contract_flowthrough's latest current balance entry. Each new ledger entry in ledger_contract_flowthrough table will trigger the insert query for ledger_contract_flowthrough_current_balance table. However, duplicate contract_flowthrough entry in ledger_contract_flowthrough would update an existing entry in ledger_contract_flowthrough_current_balance table with the latest ledger_contract_flowthrough_id of contract. """ from abacus_common_logic.connectors.database import db from abacus_common_logic.models.base import BaseModel class LedgerContractFlowthroughCurrentBalance(BaseModel): """LedgerContractFlowthroughCurrentBalance model.""" __tablename__ = 'ledger_contract_flowthrough_current_balance' ledger_contract_flowthrough_current_balance_id = db.Column( db.Integer, primary_key=True ) ledger_contract_flowthrough_id = db.Column( db.Integer, db.ForeignKey('ledger_contract_flowthrough.ledger_contract_flowthrough_id'), nullable=False, ) account_id = db.Column(db.Integer, nullable=False) contract_id = db.Column(db.Integer, nullable=False)