class Image(db.Model): __tablename__ = "image" id = db.Column(db.Integer, primary_key=True, autoincrement=True) image_name = db.Column(db.String(100), nullable=False) image_time = db.Column(db.BigInteger, default=time, onupdate=time) log_name = db.Column(db.String(100)) build_id = db.Column(db.Integer, db.ForeignKey('build_task.id')) build_task = db.relationship("Build_Task", backref=db.backref('image'))
class Patch_pkg(db.Model): __tablename__ = "patch_pkg" id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(100), nullable=False) is_patch = db.Column(db.Boolean, default=True) patch_type = db.Column(db.String(100)) url = db.Column(db.String(100)) build_id = db.Column(db.Integer, db.ForeignKey('build_task.id')) build_task = db.relationship("Build_Task", backref=db.backref('patch_pkgs'))
class Test_time(db.Model): __tablename__ = "test_time" id = db.Column(db.Integer, primary_key=True, autoincrement=True) title = db.Column(db.String(100), nullable=False) create_time = db.Column(db.BigInteger, default=time) edit_time = db.Column(db.BigInteger, default=time) build_time = db.Column(db.BigInteger, default=time) total_time = db.Column(db.BigInteger)
class User_test(db.Model): __tablename__ = "user_test" id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(100), nullable=False, unique=True) _password = db.Column("password", db.String(100), nullable=False) create_time = db.Column(db.BigInteger, default=time) @hybrid_property def password(self): return self._password @password.setter def password(self, value): """Store the password as a hash for security.""" self._password = generate_password_hash(value) def check_password(self, value): return check_password_hash(self.password, value)
class Build_Task(db.Model): __tablename__ = "build_task" id = db.Column(db.Integer, primary_key=True, autoincrement=True) task_name = db.Column(db.String(100), nullable=False) sub_desc = db.Column(db.Text) lsdk_version = db.Column(db.String(100), nullable=False) platform = db.Column(db.String(100), nullable=False) build_type = db.Column(db.String(100), nullable=False) boot_type = db.Column(db.String(100)) secure_type = db.Column(db.Boolean, default=False) kernel_version = db.Column(db.String(100)) rootfs = db.Column(db.String(100)) create_time = db.Column(db.BigInteger, default=time) edit_time = db.Column(db.BigInteger, default=time) build_time = db.Column(db.BigInteger, default=time) total_time = db.Column(db.BigInteger) build_status = db.Column(db.String(100)) percent = db.Column(db.Integer, default=0) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) owner = db.relationship("User", backref=db.backref('build_tasks'))