Add Game model

This commit is contained in:
Backend IM Bot 2025-03-26 07:04:20 +00:00
parent d7952fbe6d
commit a5a7959d18

21
models/game.py Normal file
View File

@ -0,0 +1,21 @@
from sqlalchemy import Column, String, Integer, Boolean, DateTime, Float
from sqlalchemy.sql import func
from core.database import Base
import uuid
class Game(Base):
__tablename__ = "games"
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
title = Column(String, nullable=False, index=True)
description = Column(String, nullable=True)
price = Column(Float, nullable=False)
genre = Column(String, nullable=True)
publisher = Column(String, nullable=True)
release_date = Column(DateTime, nullable=True)
rating = Column(Float, default=0.0)
in_stock = Column(Boolean, default=True)
stock_quantity = Column(Integer, default=0)
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())