Add Book model
This commit is contained in:
parent
23474fb3d3
commit
bba7849e37
@ -11,12 +11,13 @@ class Book(Base):
|
||||
title = Column(String, nullable=False, index=True)
|
||||
description = Column(String)
|
||||
isbn = Column(String, unique=True)
|
||||
publication_year = Column(Integer)
|
||||
author_id = Column(String, ForeignKey("authors.id"), nullable=False)
|
||||
publication_year = Column(Integer)
|
||||
pages = Column(Integer)
|
||||
genre = Column(String)
|
||||
publisher = Column(String)
|
||||
|
||||
# Relationships
|
||||
author = relationship("Author", back_populates="books")
|
||||
|
||||
# Timestamps
|
||||
created_at = Column(DateTime, default=func.now())
|
||||
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|
||||
|
||||
author = relationship("Author", back_populates="books")
|
Loading…
x
Reference in New Issue
Block a user