mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 05:02:57 +00:00
refactor: 重构文件导入组件为通用组件 fix: 修复导出文件名统一问题 docs: 更新README添加二次开发教程 style: 统一系统管理页面的日期选择器实现 chore: 更新数据库迁移脚本和初始化数据 perf: 优化前端页面日期范围选择交互 test: 添加演示模块相关测试文件 build: 更新依赖项配置 ci: 调整CI/CD脚本配置
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from datetime import datetime
|
|
from sqlalchemy import Boolean, Column, DateTime, Float, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.core.base_model import ModelBase
|
|
|
|
|
|
class ExampleModel(ModelBase):
|
|
"""
|
|
示例表
|
|
"""
|
|
|
|
__tablename__ = 'demo_example'
|
|
__table_args__ = ({'comment': '示例表'})
|
|
|
|
id=Column(Integer, primary_key=True, autoincrement=True, comment='ID')
|
|
name=Column(String(64), nullable=True, default='', comment='名称')
|
|
description=Column(Text, nullable=True, comment='描述')
|
|
status = Column(Boolean, default=False, nullable=True, comment='任务状态:正常,停止')
|
|
|
|
# 审计字段
|
|
description = Column(Text, nullable=True, comment="备注说明")
|
|
created_at = Column(DateTime, nullable=True, default=datetime.now, comment='创建时间')
|
|
updated_at = Column(DateTime, nullable=True, default=datetime.now, onupdate=datetime.now, comment='更新时间')
|
|
creator_id = Column(
|
|
Integer,
|
|
ForeignKey("system_users.id", ondelete="SET NULL", onupdate="CASCADE"),
|
|
nullable=True,
|
|
index=True,
|
|
comment="创建人ID"
|
|
)
|
|
creator = relationship(
|
|
"UserModel",
|
|
foreign_keys=creator_id,
|
|
lazy="joined",
|
|
post_update=True,
|
|
uselist=False
|
|
)
|
|
|