class City(db.Model): __tablename__ = 'cities' def __str__(self): return self.name # Columns id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(30)) state_id = db.Column(db.Integer, db.ForeignKey('states.id'))
class AccountStatus(db.Model): __tablename__ = 'account_status' def __str__(self): return "<Account Id: " + self.name + ">" id = db.Column(db.Integer, primary_key=True) account_id = db.Column(db.Integer, db.ForeignKey('accounts.id')) customer_id = db.Column(db.Integer, db.ForeignKey('customers.id')) account_type = db.Column(db.Integer) status = db.Column(db.Boolean, default=True) message = db.Column(db.String(255)) updated_at = db.Column( TIMESTAMP(), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) def __init__(self, account_id, customer_id, account_type, message): self.customer_id = customer_id self.account_id = account_id self.account_type = account_type self.message = message
class Account(db.Model): __tablename__ = 'accounts' def __str__(self): return self.name id = db.Column(db.Integer, primary_key=True) customer_id = db.Column(db.Integer, db.ForeignKey('customers.id')) account_type = db.Column(db.Integer) amount = db.Column(db.Integer) is_locked = db.Column(db.Boolean, default=False) created_at = db.Column(TIMESTAMP(), nullable=False) updated_at = db.Column( TIMESTAMP(), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), ) def __init__(self, customer_id, account_type, amount, created_at): self.customer_id = customer_id self.account_type = account_type self.amount = amount self.created_at = created_at