34760-vm/db/migrations/003_create_survey_questions_table.sql
Flatlogic Bot d47e350516 v1
2025-10-07 16:17:37 +00:00

9 lines
532 B
SQL

CREATE TABLE IF NOT EXISTS `survey_questions` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`survey_id` INT NOT NULL,
`question_text` TEXT NOT NULL,
`question_type` VARCHAR(50) NOT NULL, -- e.g., 'text', 'textarea', 'rating', 'multiple-choice'
`options` TEXT, -- For multiple-choice questions, store options as a JSON array or comma-separated values
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`survey_id`) REFERENCES `surveys`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;