From 063ef1f44334ffee6cfa8fa2634bd9a575a27027 Mon Sep 17 00:00:00 2001 From: chenzhirong <826531489@qq.com> Date: Tue, 23 Sep 2025 00:01:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Column=20object=20=E2=80=98created=5Ftim?= =?UTF-8?q?e=E2=80=99=20already=20assigned=20to=20Table=20=E2=80=98xxx?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/base_entity.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/entity/base_entity.py b/entity/base_entity.py index df6cdbd..159ab6a 100644 --- a/entity/base_entity.py +++ b/entity/base_entity.py @@ -10,10 +10,18 @@ from sqlmodel import SQLModel, Field class DbBaseModel(SQLModel, table=False): id: str = Field(default=None, max_length=32, primary_key=True) - created_time: int = Field(sa_column=Column(BigInteger), default_factory=current_timestamp) + created_time: int = Field( + default_factory=current_timestamp, + sa_type=BigInteger, + description="创建时间" + ) # created_by = CharField(max_length=32, index=True) - updated_time: int = Field(sa_column=Column(BigInteger, onupdate=current_timestamp), - default_factory=current_timestamp) + updated_time: int = Field( + default_factory=current_timestamp, + sa_type=BigInteger, + sa_column_kwargs={"onupdate": current_timestamp}, + description="更新时间" + ) # updated_by = CharField(max_length=32) is_deleted: int = Field(default=IsDelete.NO_DELETE)