20 lines
386 B
Text
20 lines
386 B
Text
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;
|