chore(*.psql/*.sql): update all *.psql to *.sql files
This commit is contained in:
parent
c9015a7f2b
commit
fc37600b8b
63 changed files with 21 additions and 41 deletions
17
queries/triggers/decrement_total_plays.sql
Normal file
17
queries/triggers/decrement_total_plays.sql
Normal file
|
@ -0,0 +1,17 @@
|
|||
BEGIN
|
||||
UPDATE artists
|
||||
SET total_plays = total_plays - 1
|
||||
WHERE name_string = OLD.artist_name;
|
||||
UPDATE albums
|
||||
SET total_plays = total_plays - 1
|
||||
WHERE name = OLD.album_name
|
||||
AND artist_name = OLD.artist_name;
|
||||
UPDATE genres
|
||||
SET total_plays = total_plays - 1
|
||||
WHERE id = (
|
||||
SELECT genres
|
||||
FROM artists
|
||||
WHERE name_string = OLD.artist_name
|
||||
);
|
||||
RETURN OLD;
|
||||
END;
|
Loading…
Add table
Add a link
Reference in a new issue