-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
20 lines (19 loc) · 861 Bytes
/
schema.sql
File metadata and controls
20 lines (19 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
CREATE TABLE playlists (
id VARCHAR PRIMARY KEY, -- Spotify playlist ID
name VARCHAR NOT NULL,
owner_id VARCHAR NOT NULL,
is_active BOOLEAN DEFAULT TRUE,
added_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE TABLE tracked_tracks (
track_id VARCHAR NOT NULL,
playlist_id VARCHAR NOT NULL REFERENCES playlists(id),
track_name VARCHAR NOT NULL,
artist_names TEXT[] NOT NULL,
album_name VARCHAR,
spotify_url VARCHAR,
added_at TIMESTAMPTZ, -- When the track was added to the playlist (Spotify data)
detected_at TIMESTAMPTZ DEFAULT NOW(), -- When we first detected this track
analysis TEXT, -- Groq emotional analysis (stored for weekly mood reports)
PRIMARY KEY (track_id, playlist_id)
);