14 lines
623 B
SQL
14 lines
623 B
SQL
|
|
CREATE TABLE `survey_responses` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`client_survey_id` int(11) NOT NULL,
|
|
`question_id` int(11) NOT NULL,
|
|
`response` text,
|
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
KEY `client_survey_id` (`client_survey_id`),
|
|
KEY `question_id` (`question_id`),
|
|
CONSTRAINT `survey_responses_ibfk_1` FOREIGN KEY (`client_survey_id`) REFERENCES `client_surveys` (`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `survey_responses_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `survey_questions` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|