kinit/kinit-api/db/db_base.py
ktianc 4320d2db82 feat:接口异常描述
fix:接口注释
fix:前端认证过期提示
2023-05-05 15:00:22 +08:00

26 lines
969 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
# @version : 1.0
# @Create Time : 2021/10/18 22:19
# @File : db_base.py
# @IDE : PyCharm
# @desc : 数据库公共 ORM 模型
from core.database import Model
from sqlalchemy import Column, DateTime, Integer, func, Boolean
# 使用命令alembic init alembic 初始化迁移数据库环境
# 这时会生成alembic文件夹 和 alembic.ini文件
class BaseModel(Model):
"""
公共 ORM 模型,基表
"""
__abstract__ = True
id = Column(Integer, primary_key=True, unique=True, comment='主键ID', index=True, nullable=False)
create_datetime = Column(DateTime, server_default=func.now(), comment='创建时间')
update_datetime = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment='更新时间')
delete_datetime = Column(DateTime, nullable=True, comment='删除时间')
is_delete = Column(Boolean, default=False, comment="是否软删除")