class webuser(UserMixin, db.Model): __tablename__ = 'webuser' id = db.Column(db.Integer, primary_key=True, autoincrement=True) account = db.Column(db.String(12), nullable=False) password = db.Column(db.String(12), nullable=False) phone = db.Column(db.String(11), nullable=False) email = db.Column(db.String(50), nullable=False)
class Project(db.Model): __tablename__ = 'project' uuid = db.Column(db.String(50), primary_key=True, nullable=False) # pid = db.Column(db.INT, primary_key=True, autoincrement=True) project_name = db.Column(db.String(50), nullable=False) project_region = db.Column(db.String(200), nullable=False) project_version = db.Column(db.String(50), nullable=False) project_create_time = db.Column(db.DateTime, default=datetime.now)
class User(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(50), nullable=False) password = db.Column(db.String(50), nullable=False) profile = db.relationship('Profile', backref='user', uselist=False, cascade='delete')
class Module(db.Model): __tablename__ = 'module' uuid = db.Column(db.String(50), primary_key=True, nullable=False) module_name = db.Column(db.String(50), nullable=False) module_region = db.Column(db.String(200), nullable=False) module_create_time = db.Column(db.DateTime, default=datetime.now) project_id = db.Column(db.String(50), db.ForeignKey('project.uuid')) project = db.relationship('Project', backref=db.backref('modules'))
class logs(db.Model): __tablename__ = 'logs' id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(12), nullable=False) user_type = db.Column(db.String(12), nullable=False) phone = db.Column(db.String(11), nullable=False) user_id = db.Column(db.Integer, nullable=False) logs_typeid = db.Column(db.Integer, nullable=False) beinfo = db.Column(db.String(255), nullable=False) afinfo = db.Column(db.String(255), nullable=False) date = db.Column(db.DateTime, default=datetime.now)
class equipment(db.Model): __tablename__ = 'equipment' id = db.Column(db.Integer, primary_key=True, autoincrement=True) equip_name = db.Column(db.String(30), nullable=False) equip_disc = db.Column(db.String(255), nullable=False) if_work = db.Column(db.Integer, nullable=False) equip_adr = db.Column(db.String(50), nullable=False) equip_ip = db.Column(db.String(30), nullable=False) equip_posi = db.Column(db.String(50), nullable=False) equip_image = db.Column(db.String(50), nullable=False) equip_code = db.Column(db.String(30), nullable=False)
class Case(db.Model): __tablename__ = 'case' uuid = db.Column(db.String(50), primary_key=True, nullable=False) case_id = db.Column(db.INT, autoincrement=True, nullable=False) case_name = db.Column(db.String(100), nullable=False) case_url = db.Column(db.String(100), nullable=False) case_type = db.Column(db.String(100), nullable=False) case_data = db.Column(db.Text, nullable=False) case_create_time = db.Column(db.DateTime, default=datetime.now) project_id = db.Column(db.String(50), db.ForeignKey('project.uuid')) module_id = db.Column(db.String(50), db.ForeignKey('module.uuid'))
class wx_user(db.Model): __tablename__ = 'wx_user' id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(200), nullable=False) phone = db.Column(db.String(11), nullable=False) email = db.Column(db.String(50), nullable=False) password = db.Column(db.String(100), nullable=False) wx_id = db.Column(db.String(25), nullable=False) info_number = db.Column(db.Integer, nullable=False) control_power = db.Column(db.Integer, nullable=False)
class upload_img(db.Model): __tablename__ = 'upload_img' id = db.Column(db.Integer, primary_key=True, autoincrement=True) user_id = db.Column(db.Integer, nullable=False) number = db.Column(db.Integer, nullable=False) # """ # datetime.now()获取的是服务器第一次运行的时间,以后每次的添加数据的时间都相同 # datetime.now每次创建模型的时候都会获取当前时间,即添加数据的时候获取添加数据的的当前时间,每次不相同 # """ date = db.Column(db.DateTime, default=datetime.now) imgs = db.relationship('imgs', backref='upload') equip_id = db.Column(db.Integer, nullable=False) image_desc = db.Column(db.String(255), nullable=False) image_title = db.Column(db.String(30), nullable=False)
class User(db.Model): __tablename__ = 'user' uuid = db.Column(db.String(50), primary_key=True, nullable=False) username = db.Column(db.String(50), nullable=False) password = db.Column(db.String(100), nullable=False) create_time = db.Column(db.DateTime, default=datetime.now)
class Profile(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) email = db.Column(db.String(100), nullable=False, unique=True) address = db.Column(db.String(255)) phone = db.Column(db.String(20)) uid = db.Column(db.Integer, db.ForeignKey('user.id'))
class logs_type(db.Model): __tablename__ = 'logs_type' id = db.Column(db.Integer, primary_key=True, autoincrement=True) logs_typename = db.Column(db.String(12), nullable=False)
class information(db.Model): __tablename__ = 'information' id = db.Column(db.Integer, primary_key=True, autoincrement=True) user_id = db.Column(db.Integer, nullable=False) image_id = db.Column(db.Integer, nullable=False) equip_id = db.Column(db.Integer, nullable=False)
class imgs(db.Model): __tablename__ = 'imgs' id = db.Column(db.Integer, primary_key=True, autoincrement=True) upload_id = db.Column(db.Integer, db.ForeignKey('upload_img.id')) file_path = db.Column(db.String(300), nullable=False) data_path = db.Column(db.String(300), nullable=False)