class Server(db.Model): __tablename__ = 'dns_servers' id = db.Column(db.Integer, primary_key=True) host = db.Column(db.String(64), index=True) ip = db.Column(db.String(64)) env = db.Column(db.String(64)) dns_type = db.Column(db.String(64)) status = db.Column(db.String(64), default='初始化中') logs = db.Column(db.Text())
class Logs(db.Model): __tablename__ = 'logs' id = db.Column(db.Integer, primary_key=True) operation_time = db.Column(db.DateTime(), default=datetime.now) operation_type = db.Column(db.String(64)) operator = db.Column(db.String(64)) target_type = db.Column(db.String(64)) target_name = db.Column(db.String(64)) target_id = db.Column(db.String(64)) target_detail = db.Column(db.Text())
class Server(db.Model): __tablename__ = 'dns_servers' id = db.Column(db.Integer, primary_key=True) host = db.Column(db.String(64), index=True) ip = db.Column(db.String(64)) env = db.Column(db.String(64)) dns_type = db.Column(db.String(64)) zabbix_itemid = db.Column(db.String(64)) status = db.Column(db.String(64), default='初始化中') logs = db.Column(db.Text()) def to_json(self): json_server = { 'id': self.id, 'host': self.host, 'ip': self.ip, 'env': self.env, 'dns_type': self.dns_type, 'status': self.status, 'logs': self.logs } return json_server
class View(db.Model): __tablename__ = 'dns_views' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), index=True) data = db.Column(db.Text()) zones = db.relationship('Zone', backref='view', lazy='dynamic')