Spaces:
Sleeping
Sleeping
File size: 1,518 Bytes
551658a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | from sqlalchemy import Column, Integer, String, Text, DateTime
from sqlalchemy.sql import func, text
from database import Base
class Template(Base):
__tablename__ = "templates"
id = Column(Integer, primary_key=True, index=True, comment='主键ID')
key = Column(String(50), nullable=False, server_default="", unique=True, index=True, comment='模板标识')
name = Column(String(100), nullable=False, server_default="", comment='模板名称')
description = Column(Text, nullable=False, default="", comment='模板描述')
color = Column(String(20), nullable=False, server_default="#000000", comment='模板主色调')
features = Column(Text, nullable=False, default="", comment='模板特性,JSON格式')
applicable_scene = Column(Text, nullable=False, default="", comment='适用场景')
regions = Column(Text, nullable=False, default="", comment='适用区域,JSON格式')
select_count = Column(Integer, nullable=False, server_default="0", comment='被选择总次数')
use_count = Column(Integer, nullable=False, server_default="0", comment='当前使用次数')
status = Column(Integer, nullable=False, server_default="0", comment='状态:0-不可用,1-可用')
created_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP'), comment='创建时间')
updated_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), comment='更新时间')
|