class Bonds(db.Model): __tablename__ = 'bonds' __table_args__ = {'extend_existing': True} user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) bond_id = db.Column(db.Integer, db.ForeignKey('bond.id'), primary_key=True) quantity = db.Column(db.Integer, nullable=False) timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now()) owner = db.relationship("User", backref="bond_owner") bond = db.relationship("Bond", backref="bond")
class Terms(db.Model): __tablename__ = 'terms' __table_args__ = {'extend_existing': True} user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) term_id = db.Column(db.Integer, db.ForeignKey('term.id'), primary_key=True) balance = db.Column(db.Numeric(20, 2), nullable=False) timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now()) owner = db.relationship("User", backref="term_owner") term = db.relationship("Term", backref="term")
class Sells(db.Model): __tablename__ = 'sells' __table_args__ = {'extend_existing': True} user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) bond_id = db.Column(db.Integer, db.ForeignKey('bond.id'), primary_key=True) quantity = db.Column(db.Integer, nullable=False) offer = db.Column(db.Numeric(6, 2), nullable=False) rate = db.Column(db.Numeric(4, 2), nullable=True) yd = db.Column(db.Numeric(4, 4), nullable=False) seller = db.relationship("User", backref="seller") bond = db.relationship("Bond", backref="bond_sell")
class Sends(db.Model): id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now()) note = db.Column(db.String(60), nullable=True) amount = db.Column(db.Numeric(20, 2), nullable=False) t_transaction = db.Column(db.Boolean, default=False, nullable=False) b_transaction = db.Column(db.Boolean, default=False, nullable=False) receiver = db.Column(db.Integer, nullable=False) balance = db.Column(db.Numeric(20, 2), nullable=False) sender_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
class Messages(db.Model): id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now()) receiver = db.Column(db.Integer, nullable=False) message = db.Column(db.String(300), nullable=False) sender_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
class Statuses(db.Model): id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now()) status = db.Column(db.String(), nullable=False) poster_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)