🐛 Fix the exception raised when both sa_column and primary_key are passed simultaneously

This commit is contained in:
xtaodada 2023-11-03 23:41:47 +08:00
parent c5416d7b3d
commit a5ffb257c2
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 3 additions and 7 deletions

View File

@ -10,9 +10,7 @@ class AnswerDB(SQLModel, table=True):
__tablename__ = "answer"
__table_args__ = dict(mysql_charset="utf8mb4", mysql_collate="utf8mb4_general_ci")
id: Optional[int] = Field(
default=None, primary_key=True, sa_column=Column(Integer, primary_key=True, autoincrement=True)
)
id: Optional[int] = Field(default=None, sa_column=Column(Integer, primary_key=True, autoincrement=True))
question_id: Optional[int] = Field(
sa_column=Column(Integer, ForeignKey("question.id", ondelete="RESTRICT", onupdate="RESTRICT"))
)
@ -24,9 +22,7 @@ class QuestionDB(SQLModel, table=True):
__tablename__ = "question"
__table_args__ = dict(mysql_charset="utf8mb4", mysql_collate="utf8mb4_general_ci")
id: Optional[int] = Field(
default=None, primary_key=True, sa_column=Column(Integer, primary_key=True, autoincrement=True)
)
id: Optional[int] = Field(default=None, sa_column=Column(Integer, primary_key=True, autoincrement=True))
text: Optional[str] = Field()

@ -1 +1 @@
Subproject commit 94dc4773d9dcc70fb12e58356bea4288bc82f1f6
Subproject commit e454db0f760c7c395eabab6f62cc524d50f9d935