Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DELIMITER $$
- CREATE TRIGGER `add_subscription`
- BEFORE insert ON `*_subscription`
- FOR EACH ROW BEGIN
- SET @event_id=NEW.event_id;
- SET @user_id=NEW.user_id;
- SELECT name,DATE_SUB(startDate, INTERVAL 1 HOUR)
- INTO
- @event_name,@event_time
- FROM
- `*_events`
- where id=@event_id limit 1 ;
- INSERT INTO notification VALUES( @user_id, *, @event_id, '', @event_name, @event_time, 0 );
- END$$
- DELIMITER;
- DELIMITER $$
- CREATE TRIGGER `add_subscription_del`
- BEFORE delete ON `*_subscription`
- FOR EACH ROW BEGIN
- SET @event_id=OLD.event_id;
- SET @user_id=OLD.user_id;
- DELETE FROM notification WHERE app_id=46 and app_pid=@event_id and user_id=@user_id;
- END$$
- DELIMITER;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement