From a5ffb257c29274d6cc5f7e51cf6b9c5304d6dbc3 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 3 Nov 2023 23:41:47 +0800 Subject: [PATCH] :bug: Fix the exception raised when both sa_column and primary_key are passed simultaneously --- core/services/quiz/models.py | 8 ++------ gram_core | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/services/quiz/models.py b/core/services/quiz/models.py index 99b0074a..46894958 100644 --- a/core/services/quiz/models.py +++ b/core/services/quiz/models.py @@ -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() diff --git a/gram_core b/gram_core index 94dc4773..e454db0f 160000 --- a/gram_core +++ b/gram_core @@ -1 +1 @@ -Subproject commit 94dc4773d9dcc70fb12e58356bea4288bc82f1f6 +Subproject commit e454db0f760c7c395eabab6f62cc524d50f9d935