Merge pull request 'Implement history' (#98) from 41-implement-history into main

Reviewed-on: LibreTunes/LibreTunes#98
This commit is contained in:
2024-09-29 18:27:08 +00:00
9 changed files with 418 additions and 13 deletions

View File

@ -0,0 +1,2 @@
DROP INDEX song_history_user_id_idx;
DROP TABLE song_history;

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);