class HostExtend(db.Model, ModelMixin): __tablename__ = 'assets_hosts_extend' id = db.Column(db.Integer, primary_key=True) host_id = db.Column(db.Integer, db.ForeignKey('assets_hosts.id')) operate_system = db.Column(db.String(64)) memory = db.Column(db.SmallInteger) cpu = db.Column(db.SmallInteger) disk = db.Column(db.SmallInteger) outer_ip = db.Column(db.String(128)) inner_ip = db.Column(db.String(128)) hosts = db.relationship(Host, backref=db.backref('host'))
class ImageTag(db.Model, ModelMixin): __tablename__ = 'deploy_image_tags' id = db.Column(db.Integer, primary_key=True) image_id = db.Column(db.Integer, db.ForeignKey('deploy_images.id')) name = db.Column(db.String(50)) # sha256加密字符串,例如(sha256:a6647f8a2744cb8bfeff0a1b8623c8070dd92b0e6708ffa04ceb5349eaf492d6) digest = db.Column(db.String(64 + 7)) created = db.Column(db.String(20)) image = db.relationship(Image, backref=db.backref('tags')) def __repr__(self): return '<ImageTag %r>' % self.name
class HostExtend(db.Model, ModelMixin): __tablename__ = 'assets_hosts_extend' id = db.Column(db.Integer, primary_key=True) host_id = db.Column(db.Integer, db.ForeignKey('assets_hosts.id')) operate_system = db.Column(db.String(64)) memory = db.Column(db.SmallInteger) cpu_core = db.Column(db.SmallInteger) avaliable_mem = db.Column(db.SmallInteger) avaliable_core = db.Column(db.SmallInteger) hosts = db.relationship(Host, backref=db.backref('host')) create_time = db.Column(db.DateTime, server_default=func.now(), comment='创建时间') # onupdate设置自动更改 update_time = db.Column( db.DateTime, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), comment='修改时间')