Initial commit — PlantGuideScraper project
This commit is contained in:
14
backend/app/models/cached_stats.py
Normal file
14
backend/app/models/cached_stats.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class CachedStats(Base):
|
||||
"""Stores pre-calculated statistics updated by Celery beat."""
|
||||
__tablename__ = "cached_stats"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
key = Column(String(50), unique=True, nullable=False, index=True)
|
||||
value = Column(Text, nullable=False) # JSON-encoded stats
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
Reference in New Issue
Block a user