· 8 years ago · Apr 23, 2018, 08:18 AM
1CREATE TABLE IF NOT EXISTS `survey` (
2 `surv_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
3 `acct_id` BIGINT UNSIGNED NOT NULL,
4 `event_id` BIGINT UNSIGNED NOT NULL,
5 `city_id` BIGINT UNSIGNED NOT NULL,
6 `temp_id` BIGINT UNSIGNED NOT NULL,
7 `surv_data` LONGTEXT NOT NULL,
8 `surv_created_at` DATETIME NOT NULL,
9 `surv_status` SMALLINT(1) NOT NULL,
10 PRIMARY KEY (`surv_id`),
11 FULLTEXT KEY `data` ( `surv_data` ),
12 CONSTRAINT `survey_fk_1` FOREIGN KEY (`acct_id`)
13 REFERENCES `account` (`acct_id`)
14 ON DELETE CASCADE ON UPDATE CASCADE,
15 CONSTRAINT `survey_fk_2` FOREIGN KEY (`event_id`)
16 REFERENCES `event` (`event_id`)
17 ON DELETE CASCADE ON UPDATE CASCADE,
18 CONSTRAINT `survey_fk_3` FOREIGN KEY (`temp_id`)
19 REFERENCES `survey_template` (`temp_id`)
20 ON DELETE CASCADE ON UPDATE CASCADE,
21 CONSTRAINT `survey_fk_4` FOREIGN KEY (`city_id`)
22 REFERENCES `city` (`city_id`)
23 ON DELETE CASCADE ON UPDATE CASCADE
24) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE = UTF8MB4_GENERAL_CI;