

CREATE TABLE `was_snackbar_notification` (
  `snackbar_notification_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL,
  `type` ENUM('LIVE_EVENT') NOT NULL,
  `type_id` int(11) unsigned NOT NULL,
  `reminder_date` int(11) unsigned NOT NULL DEFAULT 0,
  `dismissed_date` int(11) unsigned NOT NULL DEFAULT 0,
  `insert_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `update_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`snackbar_notification_id`),
  KEY `idx_user_snackbar_notification` (`user_id`, `type`, `type_id`),
  KEY `idx_snackbar_notification` (`type`, `type_id`),
  KEY `idx_snackbar_reminder` (`reminder_date`),
  KEY `idx_snackbar_dismissed` (`dismissed_date`)
) ENGINE=InnoDB COMMENT='Stores the snackbar notification display status as by users';

CREATE TRIGGER `was_snackbar_notification_insert_timestamp` BEFORE INSERT ON `was_snackbar_notification`
FOR EACH ROW SET NEW.insert_timestamp = NOW();