three60/drizzle/0004_motionless_havok.sql
2025-04-21 09:03:19 +02:00

11 lines
No EOL
810 B
SQL

CREATE TABLE `survey_comments_table` (
`id` int AUTO_INCREMENT NOT NULL,
`surveyId` int NOT NULL,
`participantId` int NOT NULL,
`comment` text NOT NULL,
CONSTRAINT `survey_comments_table_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
ALTER TABLE `survey_comments_table` ADD CONSTRAINT `survey_comments_table_surveyId_surveys_table_id_fk` FOREIGN KEY (`surveyId`) REFERENCES `surveys_table`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `survey_comments_table` ADD CONSTRAINT `survey_comments_table_participantId_survey_access_table_id_fk` FOREIGN KEY (`participantId`) REFERENCES `survey_access_table`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX `survey_participant_index` ON `survey_comments_table` (`surveyId`,`participantId`);