Add initial project
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
"""Daily Context Model - Stores subjective user inputs like mood, tags, etc."""
|
||||
from sqlalchemy import Column, Integer, String, Date, ForeignKey, UniqueConstraint
|
||||
from backend.database import Base
|
||||
|
||||
class DailyContext(Base):
|
||||
__tablename__ = "daily_context"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), index=True)
|
||||
date = Column(Date, index=True)
|
||||
|
||||
mood_score = Column(Integer) # 1-100 slider
|
||||
tags = Column(String, nullable=True) # Comma separated tags e.g. "Alcohol,Stress"
|
||||
notes = Column(String, nullable=True)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint('user_id', 'date', name='uq_daily_context'),
|
||||
)
|
||||
Reference in New Issue
Block a user