
CREATE TABLE `was_chat_like_count` (
  `chat_like_count_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `chat_message_id` int(11) unsigned DEFAULT NULL,
  `like_count` int(11) unsigned DEFAULT NULL,
  `update_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `insert_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`chat_like_count_id`),
  KEY `idx_chat_message_id` (`chat_message_id`)
) ENGINE=InnoDB COMMENT='stores chat message like count';

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