
CREATE TABLE `was_item_category_comment` (
  `item_category_comment_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `item_category_id` int(11) unsigned NOT NULL,
  `comment_id` int(11) unsigned NOT NULL,
  `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 (`item_category_comment_id`),
  KEY `idx_item_category` (`item_category_id`),
  KEY `idx_comment_id` (`comment_id`)
) ENGINE=InnoDB COMMENT='stores recent 100 comments per item category';

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