class Comment(Model): __table__ = 'comments' # 表名 id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') # ID主键 blog_id = StringField(ddl='varchar(50)') # 日志ID user_id = StringField(ddl='varchar(50)') # 用户ID user_name = StringField(ddl='varchar(50)') # 用户名 user_image = StringField(ddl='varchar(500)') # 用户图像 content = TextField() # 内容 created_at = FloatField(default=time.time) # 创建时间
class User(Model): #定义在User类中的__table__、id和name等是类的属性,不是实例的属性 __table__ = 'users' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_at = FloatField(default=time.time) #日期和时间用float类型存储在数据库中
class Comment(Model): __table__ = "comments" id = StringField(primary_key=True, default=next_id, ddl="varchar(50)") blog_id = StringField(ddl="varchar(50)") user_id = StringField(ddl="varchar(50)") user_name = StringField(ddl="varchar(50)") user_image = StringField(ddl="varchar(500)") content = TextField() created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' # 表名 id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') # ID主键 email = StringField(ddl='varchar(50)') # 邮件 passwd = StringField(ddl='varchar(50)') # 密码 admin = BooleanField() # 是否是管理员 name = StringField(ddl='varchar(50)') # 姓名 image = StringField(ddl='varchar(500)') # 头像 created_at = FloatField(default=time.time) # 创建时间
class UserGifts(Model): __table__ = 'user_gifts' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') user_id = StringField(ddl='varchar(50)') user_name = StringField(ddl='varchar(50)') user_email = StringField(ddl='varchar(50)') activity_id = StringField(ddl='varchar(50)') gift_id = StringField(ddl='varchar(50)') gift_name = StringField(ddl='varchar(50)') gift_image = StringField(ddl='varchar(500)') created_at = FloatField(default=time.time)
class Blog(Model): __table__ = 'blogs' id = IntegerField(primary_key=True) user_id = IntegerField() user_name = StringField(column_type='varchar(50)') user_image = StringField(column_type='varchar(500)') name = StringField(column_type='varchar(50)') summary = StringField(column_type='varchar(200)') content = TextField() created_at = FloatField(default=time.time)
class Comment(Model): __table__ = 'comments' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') blog_id = StringField(ddl="varchar(50)") # 博客id user_id = StringField(ddl="varchar(50)") # 评论者id user_name = StringField(ddl="varchar(50)") # 评论者名字 user_image = StringField(ddl="varchar(500") # 评论者上传的图片 content = TextField() created_at = FloatField(default=time.time)
class Blog(Model): __table__ = 'blogs' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') user_id = StringField(ddl='varchar(50)') user_name = StringField(ddl='varchar(50)') user_image = StringField(ddl='varchar(500)') name = StringField(ddl='varchar(50)') summary = StringField(ddl='varchar(200)') content = TextField() created_at = FloatField(default=time.time)
class Reply(Model): __table__ = 'reply' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') comment_id = StringField(ddl='varchar(50)') user_id = StringField(ddl='varchar(50)') reply_user_id = StringField(ddl='varchar(50)') user_name = StringField(ddl='varchar(50)') user_image = StringField(ddl='varchar(500)') content = TextField() created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') # 时间和日期用float类型存储在数据库中,不要datetime类型的好处是不必关心数据库的时区和时区转换,显示时只需要做一个float到str的转换 created_at = FloatField(default=time.time)
class Interviews(Model): __table__ = 'interviews' stu_id = StringField(primary_key=True, ddl='varchar(10)') created_at = FloatField(default=time.time) grade_1 = IntegerField() grade_2 = IntegerField() grade_3 = IntegerField() grade_4 = IntegerField() grade_5 = IntegerField() extra = StringField(ddl='varchar(500)')
class Blog(Model): __table__ = "blog" id = StringField(primary_key=True, default=next_id, ddl="varchar(50)") user_id = StringField(ddl="varchar(50)") user_name = StringField(ddl="varchar(50)") user_image = StringField(ddl='varchar(500)') name = StringField(ddl="varchar(50)") summary = StringField(ddl="varchar(100)") content = TextField() create_time = FloatField(default=time.time)
class User(Model): __table__ = 'users' #定义属性的类型和默认参数!这些参数会传入metaclass来生成User类 id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_at = FloatField(default=time.time)
class Blog(Model): __table__ = "blogs" id = StringField(primary_key=True, default=next_id, ddl="varchar(50)") user_id = StringField(ddl="varchar(50)") # 作者id user_name = StringField(ddl="varchar(50)") # 作者名 user_image = StringField(ddl="varchar(500)") # 作者头像图片 name = StringField(ddl="varchar(50)") # 文章名 summary = StringField(ddl="varchar(200)") # 文章概要 content = TextField() # 文章正文 created_at = FloatField(default=time.time) # 创建时间
class Goods(Model): __table__ = 'goods' id = StringField(primary_key=True, default=random_id, ddl='varchar(50)') owner_account = StringField(updatable=False, ddl='varchar(50)') goods_name = StringField(ddl='varchar(20)') img_filename = StringField(ddl='varchar(50') goods_price = FloatField(default=0.0, ddl='real(4)') buyer_account = StringField(ddl='varchar(50)') description = StringField(updatable=False,ddl='varchar(200)') status = IntegerField(default=0)
class Comment(Model): '''数据表comments''' __table__ = 'comments' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') blog_id = StringField(ddl='varchar(50)') user_id = StringField(ddl='varchar(50)') user_name = StringField(ddl='varchar(50)') user_image = StringField(ddl='varchar(500)') content = TextField() created_at = FloatField(default=time.time)
class User(Model): '''数据表users''' __table__ = 'users' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' #根据系统当前时间15位和一个随机得到的UUID 填充3个0 组成一个长度为50的字符串 id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_at = FloatField(default=time.time)
class Chart(Model): __table__ = 'charts' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') project_id = StringField(ddl='varchar(50)') user_id = StringField(ddl='varchar(50)') index = IntegerField() status = BooleanField() created_at = FloatField(default=time.time) type = StringField(ddl='varchar(50)') option = TextField() description = TextField()
class User(Model): __table__ = "users" id = StringField(column_type="varchar(50)", primary_key=True, default=next_id) email = StringField(column_type="varchar(50)") password = StringField(column_type="varchar(50)") admin = BooleanField() name = StringField(column_type="varchar(50)") image = StringField(column_type="varchar(500)") created_at = FloatField(default=time.time)
class WeaponChangeTopic(Model): __table__ = 'weapon_change_topic' id = IntegerField(primary_key=True) comefrom = StringField(ddl='varchar(10)') topicId = StringField(ddl='varchar(50)') title = StringField(ddl='varchar(10)') player = StringField(ddl='char(20)') details = StringField(ddl='text') topicTitle = StringField(ddl='varchar(50)') topicList = StringField(ddl='text') img = StringField(ddl='varchar(50)') createTime = FloatField(default=time.time())
class User(Model): # User表,包括id email passwd admin name image create_at这几列 #其中id是主键 __table__ = 'users' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl="varchar(50)") admin = BooleanField() #是不是管理员身份 name = StringField(ddl="varchar(50)") image = StringField(ddl="varchar(500)") created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' id = StringField(primary_key=True, default=next_id(), ddl='varchar(50)', name='id') email = StringField(ddl='varchar(50)', name='email') password = StringField(ddl='varchar(50)', name='password') admin = BooleanField(name='admin') name = StringField(name='name', ddl='varchar(50)') image = StringField(name='image', ddl='varchar(500)') created_at = FloatField(name='created_at', default=time.time())
class Pic(Model): #图片表 __table__ = 'pic' id = StringField(primary_key=True, default=next_id, ddl='varchar(60)') title = StringField(ddl='varchar(60)') author = StringField(ddl='varchar(60)') source = StringField(ddl='varchar(60)') labels = StringField(ddl='varchar(500)') cate = StringField(ddl='varchar(60)') path = StringField(ddl='varchar(60)') created_time = FloatField(default=time.time()) is_del = BooleanField()
class User(Model): __table__ = 'users' # next_id(funtion name as the args) id = StringField(primary_key=True, default=next_id, column_type='varchar(50)') email = StringField(column_type='varchar(50)') passwd = StringField(column_type='varchar(50)') admin = BooleanField() name = StringField(column_type='varchar(50)') image = StringField(column_type='varchar(500)') # time.time(funtion name as the args) created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' id = StringField( primary_key=True, default=next_id, ddl='varchar(50)') #Passing next_id for future initiation. email = StringField(ddl='varchar(50)') password = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_time = FloatField(default=time.time)
class User(Model): __table__ = 'users' #定义表名 id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') #定义id为主键,调用next_id方法后获得默认值 email = StringField(ddl='varchar(50)') #邮箱 passwd = StringField(ddl='varchar(50)') #密码 admin = BooleanField() #管理员身份,值为1表示该用户为管理员,值为0表示该用户不是管理员 name = StringField(ddl='varchar(50)') #名字 image = StringField(ddl='varchar(500)') #应该是头像吧 created_at = FloatField( default=time.time) #创建时间默认为当前时间,也是要调用time.time方法后获得
class Comment(Model): __table__ = 'comments' # 缺省值可以作为函数对象传入,在调用save()时自动计算 id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') blog_id = StringField(ddl='varchar(50)') user_id = StringField(ddl='varchar(50)') user_name = StringField(ddl='varchar(50)') user_image = StringField(ddl='varchar(500)') content = TextField() # 缺省值可以作为函数对象传入,在调用save()时自动计算 created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' # 在编写ORM时,给一个Field增加一个default参数可以让ORM自己填入缺省值,非常方便。 # 并且,缺省值可以作为函数对象传入,在调用save()时自动计算。 id = StringField(primary_key=True, default=next_id(), ddl='varchar(50)') email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_at = FloatField(default=time.time)
class User(Model): __table__ = 'users' id = StringField(primary_key=True, default=next_id, ddl='varchar(50)') # default id is the next_id email = StringField(ddl='varchar(50)') passwd = StringField(ddl='varchar(50)') admin = BooleanField() name = StringField(ddl='varchar(50)') image = StringField(ddl='varchar(500)') created_at = FloatField( default=time.time) # default time is current date and time