2025-01-22 23:36:03 +01:00

22 lines
714 B
SQL

CREATE TABLE survey (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL COLLATE utf8_czech_ci,
comments TEXT COLLATE utf8_czech_ci,
agreement BOOLEAN NOT NULL
);
CREATE INDEX idx_survey_name ON survey (name);
CREATE FULLTEXT INDEX idx_survey_comments ON survey (comments);
CREATE TABLE interests
(
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
survey_id BIGINT UNSIGNED NOT NULL,
interest VARCHAR(255) NOT NULL COLLATE utf8_czech_ci ,
FOREIGN KEY (survey_id) REFERENCES survey (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX idx_interests_survey_id ON interests (survey_id);
CREATE INDEX idx_interests_interest ON interests (interest);