feat: initial commit
This commit is contained in:
commit
e214116e40
253 changed files with 17406 additions and 0 deletions
20
queries/triggers/update_total_plays.psql
Normal file
20
queries/triggers/update_total_plays.psql
Normal file
|
@ -0,0 +1,20 @@
|
|||
BEGIN
|
||||
UPDATE artists
|
||||
SET total_plays = total_plays + 1
|
||||
WHERE name_string = NEW.artist_name;
|
||||
|
||||
UPDATE albums
|
||||
SET total_plays = total_plays + 1
|
||||
WHERE key = NEW.album_key
|
||||
AND artist_name = NEW.artist_name;
|
||||
|
||||
UPDATE genres
|
||||
SET total_plays = total_plays + 1
|
||||
WHERE id = (
|
||||
SELECT genres
|
||||
FROM artists
|
||||
WHERE name_string = NEW.artist_name
|
||||
);
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
Loading…
Add table
Add a link
Reference in a new issue