from sqlalchemy import Column, String, Date, Integer, ForeignKey, Text from sqlalchemy.orm import relationship from app.models.base import BaseModel class Album(BaseModel): """Album model representing a collection of songs.""" __tablename__ = "albums" title = Column(String, nullable=False, index=True) release_date = Column(Date, nullable=True) cover_image_path = Column(String, nullable=True) # Path to album cover image description = Column(Text, nullable=True) # Foreign keys artist_id = Column(Integer, ForeignKey("artists.id"), nullable=False) # Relationships artist = relationship("Artist", back_populates="albums") songs = relationship("Song", back_populates="album", cascade="all, delete-orphan") def __repr__(self): return f""