Restructure into full project layout
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from sqlalchemy import String, Integer, ForeignKey, JSON, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class CollectionCard(Base):
|
||||
__tablename__ = "user_collection"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
owner_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
card_name: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
set_code: Mapped[str] = mapped_column(String(10), nullable=False, default="")
|
||||
collector_number: Mapped[str] = mapped_column(String(20), nullable=False, default="")
|
||||
quantity: Mapped[int] = mapped_column(Integer, default=0)
|
||||
foil_quantity: Mapped[int] = mapped_column(Integer, default=0)
|
||||
scryfall_id: Mapped[str] = mapped_column(String(36), nullable=False, default="")
|
||||
scryfall_data: Mapped[dict | None] = mapped_column(JSON)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint("owner_id", "scryfall_id", name="uq_owner_scryfall"),
|
||||
)
|
||||
Reference in New Issue
Block a user