class User(db.Model, Util): id = db.Column(db.Integer, autoincrement=True, primary_key=True) username = db.Column(db.String(32), unique=True, nullable=False) password = db.Column(db.String(256), nullable=False) email = db.Column(db.String(64), nullable=False) # 是否激活,默认否 active = db.Column(db.Boolean, default=False, comment='是否激活') # 逻辑删除,注销用户flag,0为删除 flag = db.Column(db.Boolean, default=True, comment='是否逻辑删除') token = db.Column(db.String(64), unique=True, comment='获取一个uuid,做邮箱激活验证')
class Function(db.Model, ModelUtil): id = db.Column(db.Integer, primary_key=True) tittle = db.Column(db.String(128), nullable=False) desc = db.Column(db.Text, nullable=False) ftoken = db.Column(db.String(256), nullable=False) ishow = db.Column(db.Boolean, default=False) showpic = db.Column(db.String(256), nullable=False) desctitle1 = db.Column(db.String(64), nullable=False) descontext1 = db.Column(db.Text, nullable=False) desctitle2 = db.Column(db.String(64), nullable=True) descontext2 = db.Column(db.Text, nullable=True) desctitle3 = db.Column(db.String(64), nullable=True) descontex3 = db.Column(db.Text, nullable=True) desctitle4 = db.Column(db.String(64), nullable=True) descontex4 = db.Column(db.Text, nullable=True)
class User(BaseModel): __tablename__ = 'tb_ihome_user' id = db.Column(db.INTEGER, primary_key=True) phone = db.Column(db.String(11), unique=True) passwd_hash = db.Column(db.String(200)) name = db.Column(db.String(30), unique=True) avatar = db.Column(db.String(100)) # 头像 id_name = db.Column(db.String(30)) # 实名认证姓名 id_card = db.Column(db.String(18), unique=True) # 实名认证身份证 houses = db.relationship('House', backref='user') orders = db.relationship('Order', backref='user') # @property def password(self): return '' @password.setter def password(self, pwd): self.passwd_hash = generate_password_hash(pwd)
class Indexpic(db.Model, ModelUtil): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(62), unique=True) src = db.Column(db.String(256), unique=True)
class Blog(db.Model, Util): id = db.Column(db.Integer, autoincrement=True, primary_key=True) content = db.Column(db.TEXT, comment='博客内容') u_id = db.Column(db.Integer, db.ForeignKey(User.id, ondelete='CASCADE')) title = db.Column(db.String(64), unique=True, nullable=False) last_time = db.Column(db.DateTime, comment='最近修改时间')