30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from sqlalchemy import Column, String, Float, DateTime, ForeignKey, Text
|
|
from sqlalchemy.sql import func
|
|
from ..db.database import Base
|
|
|
|
class MoodCategory(Base):
|
|
__tablename__ = "mood_categories"
|
|
|
|
id = Column(String, primary_key=True, index=True)
|
|
name = Column(String, unique=True, nullable=False)
|
|
color_hex = Column(String, nullable=False)
|
|
description = Column(String)
|
|
background_image = Column(String)
|
|
icon_path = Column(String)
|
|
|
|
class MoodSong(Base):
|
|
__tablename__ = "mood_songs"
|
|
|
|
mood_id = Column(String, ForeignKey("mood_categories.id"), primary_key=True)
|
|
song_id = Column(String, ForeignKey("songs.id"), primary_key=True)
|
|
confidence_score = Column(Float, default=0)
|
|
analyzed_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
class LyricsCache(Base):
|
|
__tablename__ = "lyrics_cache"
|
|
|
|
song_id = Column(String, ForeignKey("songs.id"), primary_key=True)
|
|
lyrics_text = Column(Text)
|
|
mood_tags_json = Column(String)
|
|
analyzed_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
source_url = Column(String) |