Files
railway_cloud/app/models/checkpoint.py
2025-10-30 11:43:32 +08:00

19 lines
754 B
Python

from sqlalchemy import Column, Integer, String
from ..core.database import Base
class Checkpoint(Base):
__tablename__ = "checkpoint"
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
aname = Column(String(100), nullable=False, comment="观察点名称")
burial_date = Column(String(100), comment="埋设日期")
section_id = Column(String(100), nullable=False, comment="所属断面id")
point_id = Column(String(100), nullable=False, comment="观察点id")
# 模型转字典
def to_dict(self):
"""将模型实例转换为字典,支持 Pydantic 序列化"""
return {
column.name: getattr(self, column.name)
for column in self.__table__.columns
}