From 84df581763b6e8d9d0a50be31e1099ecff2264da Mon Sep 17 00:00:00 2001 From: Thastertyn Date: Tue, 14 Jan 2025 17:44:52 +0100 Subject: [PATCH] [main] Updated models to reflect current constraints --- src/models/book_category_link.py | 4 ++-- src/models/member.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/book_category_link.py b/src/models/book_category_link.py index df29c31..e653602 100644 --- a/src/models/book_category_link.py +++ b/src/models/book_category_link.py @@ -8,8 +8,8 @@ from .base import Base class BookCategoryLink(Base): __tablename__ = 'book_category_link' - book_id = Column(Integer, ForeignKey('book.id'), primary_key=True) - book_category_id = Column(Integer, ForeignKey('book_category.id'), primary_key=True) + book_id = Column(Integer, ForeignKey('book.id', ondelete="cascade"), primary_key=True) + book_category_id = Column(Integer, ForeignKey('book_category.id', ondelete="cascade"), primary_key=True) book = relationship('Book', overlaps='categories,books') book_category = relationship('BookCategory', overlaps='categories,books') \ No newline at end of file diff --git a/src/models/member.py b/src/models/member.py index 79ee7dc..4054c1f 100644 --- a/src/models/member.py +++ b/src/models/member.py @@ -19,7 +19,7 @@ class Member(Base): first_name = Column(String(50), nullable=False) last_name = Column(String(50), nullable=False) email = Column(String(100), nullable=False, unique=True) - phone = Column(String(20), nullable=True) + phone = Column(String(20), nullable=True, unique=True) register_date = Column(TIMESTAMP, nullable=True, server_default=func.now()) status = Column(Enum(MemberStatusEnum), nullable=True, default=MemberStatusEnum.active) last_updated = Column(TIMESTAMP, nullable=True) \ No newline at end of file