all repos — moviedb @ 5e82b1b6e63b51d448914dbe5872b5d255b1b594

A Flask web-app to browse movie information from IMDb using imdbpy

mysql/procedure_triggers/trigger_recent_fav.sql

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* recent_fav is exactly what it sounds like - its the recent most
   favourited movie of the user.
*/
DELIMITER $$
DROP TRIGGER IF EXISTS after_fav_insert $$
CREATE TRIGGER after_fav_insert
AFTER INSERT
ON fav FOR EACH ROW
BEGIN
    update user_info
    set recent_fav = (
        select concat(primaryTitle, ' (', startYear, ')')
        from title_basics
        where tconst=NEW.tconst
    )
    where user_id=new.user_id;
END $$
DELIMITER ;