package models import ( "time" "github.com/google/uuid" "gorm.io/gorm" ) // TrackLyrics stores lyrics content for a track (E3) type TrackLyrics struct { ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id" db:"id"` TrackID uuid.UUID `gorm:"type:uuid;not null;uniqueIndex" json:"track_id" db:"track_id"` Content string `gorm:"type:text;not null" json:"content" db:"content"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at" db:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" db:"updated_at"` DeletedAt gorm.DeletedAt `json:"-" db:"deleted_at"` Track Track `gorm:"foreignKey:TrackID;constraint:OnDelete:CASCADE" json:"-"` } // TableName defines the table name for GORM func (TrackLyrics) TableName() string { return "track_lyrics" } // BeforeCreate hook for UUID func (m *TrackLyrics) BeforeCreate(tx *gorm.DB) error { if m.ID == uuid.Nil { m.ID = uuid.New() } return nil }