
CREATE TABLE `was_hub_research` (
  `research_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `business_id` int(11) unsigned NOT NULL,
  `research_type` varchar(100) 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 (`research_id`),
  KEY `idx_business_id` (`business_id`)
) ENGINE=InnoDB COMMENT='stores business ID and research type';

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


CREATE TABLE `was_hub_research_result` (
  `research_result_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `research_id` int(11) unsigned NOT NULL,
  `research_result` varchar(100) 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 (`research_result_id`),
  KEY `idx_research_id` (`research_id`)
) ENGINE=InnoDB COMMENT='stores niche research result for business and research type';

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