Add DB table for song history

This commit is contained in:
2024-05-19 12:44:47 -04:00
parent 7bcb5f8c04
commit 81f0b9310f
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,8 @@
CREATE TABLE song_history (
id SERIAL PRIMARY KEY UNIQUE NOT NULL,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
date TIMESTAMP NOT NULL DEFAULT NOW(),
song_id INTEGER REFERENCES songs(id) ON DELETE CASCADE NOT NULL
);
CREATE INDEX song_history_user_id_idx ON song_history(user_id);