Add Book model
This commit is contained in:
parent
4ecc04219f
commit
6a9d584b55
15
models/book.py
Normal file
15
models/book.py
Normal file
@ -0,0 +1,15 @@
|
||||
from sqlalchemy import Column, String, DateTime
|
||||
from sqlalchemy.sql import func
|
||||
from core.database import Base
|
||||
import uuid
|
||||
|
||||
class Book(Base):
|
||||
__tablename__ = "books"
|
||||
|
||||
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||
title = Column(String, nullable=False, index=True)
|
||||
author = Column(String, nullable=False)
|
||||
description = Column(String)
|
||||
isbn = Column(String, unique=True)
|
||||
created_at = Column(DateTime, default=func.now())
|
||||
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|
Loading…
x
Reference in New Issue
Block a user