
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);
