Ledger Nano X - The secure hardware wallet
SHARE
TWEET

create trigger

krot Aug 29th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DELIMITER $$
  2. CREATE TRIGGER `add_subscription`
  3. BEFORE insert ON `*_subscription`
  4. FOR EACH ROW  BEGIN
  5.  
  6.     SET @event_id=NEW.event_id;
  7.     SET @user_id=NEW.user_id;
  8.  
  9. SELECT name,DATE_SUB(startDate, INTERVAL 1 HOUR)
  10. INTO
  11.   @event_name,@event_time
  12. FROM
  13.   `*_events`
  14. where id=@event_id  limit 1 ;
  15.  
  16. INSERT INTO notification            VALUES(         @user_id,           *,          @event_id,          '',          @event_name,           @event_time,            0   );
  17.  
  18. END$$
  19. DELIMITER; 
  20.  
  21.  
  22. DELIMITER $$
  23. CREATE TRIGGER `add_subscription_del`
  24. BEFORE delete ON `*_subscription`
  25. FOR EACH ROW  BEGIN
  26.     SET @event_id=OLD.event_id;
  27.     SET @user_id=OLD.user_id;
  28.     DELETE FROM notification WHERE app_id=46 and app_pid=@event_id and user_id=@user_id;
  29. END$$
  30. DELIMITER;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top