mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-24 05:26:58 +00:00
- 统一示例表注释格式,去除兼容说明 - 取消 GenTableModel 和 GenTableColumnModel 中的 @declared_attr 装饰器,改用类属性定义表名和表注释 - 移除 GenTableModel 中冗余字段定义如删除标志、创建人、更新时间等,简化模型 - 调整字段 table_id 顺序至 GenTableColumnModel 中末尾,保证定义统一 - 修改导入的 sqlalchemy 模块,去除未使用的类型和方法 - 在 GenTableColumnBaseSchema 中添加 create_by 字段,完善字段信息描述
19 lines
571 B
Python
19 lines
571 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Optional
|
|
from sqlalchemy import Boolean, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.core.base_model import CreatorMixin
|
|
|
|
|
|
class DemoModel(CreatorMixin):
|
|
"""
|
|
示例表
|
|
"""
|
|
__tablename__ = 'example_demo'
|
|
__table_args__ = ({'comment': '示例表'})
|
|
|
|
name: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, default='', comment='名称')
|
|
status: Mapped[bool] = mapped_column(Boolean(), default=True, nullable=False, comment="是否启用(True:启用 False:禁用)")
|