
CREATE TABLE `was_hub_build_state` (
  `hub_build_state_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL,
  `domain_name` varchar(255) DEFAULT NULL,
  `current_step` varchar(32) DEFAULT NULL,
  `steps_completed` varchar(255) DEFAULT NULL,
  `business_type` enum('new','existing') DEFAULT NULL,
  `niche_type` enum('own','promote') DEFAULT NULL,
  `niche_id` int(11) unsigned DEFAULT NULL,
  `brand` varchar(100) DEFAULT 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 (`hub_build_state_id`),
  UNIQUE KEY `unq_user_id` (`user_id`)
) ENGINE=InnoDB COMMENT='stores users hub build state';

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