Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE IF NOT EXISTS `notification_emails` (
- `id` INT PRIMARY KEY AUTO_INCREMENT,
- `recipient` INT,
- `subject` TEXT,
- `body` TEXT
- );
- TRUNCATE TABLE `notification_emails`;
- DROP TRIGGER IF EXISTS `tr_logs_change_email`;
- DELIMITER $$
- CREATE TRIGGER `tr_logs_change_email`
- AFTER INSERT ON `logs`
- FOR EACH ROW
- BEGIN
- INSERT `notification_emails`( `recipient`,`subject`,`body`)
- VALUES (`account_id`,CONCAT_WS(' ','Balance change for account:', `account_id`),
- CONCAT_WS(' ','On',NOW(),'your balance was changed from',`old_sum`,'to',`new_sum`,'.'));
- END $$
- DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement