From 61157316a2360041009c158e7a2860afb260dbb7 Mon Sep 17 00:00:00 2001 From: cato447 Date: Mon, 20 Apr 2026 00:37:38 +0200 Subject: [PATCH] fixed constraints --- app/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models.py b/app/models.py index 5a1ea6c..ef477dc 100644 --- a/app/models.py +++ b/app/models.py @@ -78,10 +78,13 @@ class Password(db.Model): class Deck(db.Model): __tablename__ = "deck" - __table_args__ = (UniqueConstraint("course_id", "deck", name="_course_deck_uc"),) + __table_args__ = ( + UniqueConstraint("course_id", "deck", name="_course_deck_uc"), + UniqueConstraint("course_id", "name", name="_course_name_uc"), + ) id: Mapped[int] = mapped_column(primary_key=True) - name: Mapped[str] = mapped_column(String(60), unique=True, nullable=False) + name: Mapped[str] = mapped_column(String(60), nullable=False) deck: Mapped[str] = mapped_column(String(60), nullable=False) description: Mapped[str] = mapped_column(String(200)) index_file: Mapped[str] = mapped_column(String(40), nullable=False)