MySQL structure for surveys
[platal.git] / upgrade / 0.9.14 / 07_survey.sql
1 CREATE TABLE `survey_answers` (
2 `id` smallint(5) unsigned NOT NULL auto_increment,
3 `survey_id` smallint(4) unsigned NOT NULL,
4 `vote_id` smallint(5) unsigned NOT NULL,
5 `question_id` smallint(3) unsigned NOT NULL,
6 `answer` text NOT NULL,
7 PRIMARY KEY (`id`),
8 UNIQUE KEY `vote` (`survey_id`,`vote_id`,`question_id`)
9 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
10
11
12 CREATE TABLE `survey_questions` (
13 `survey_id` smallint(4) unsigned NOT NULL auto_increment,
14 `questions` mediumtext NOT NULL,
15 `title` varchar(255) NOT NULL,
16 `description` text NOT NULL,
17 `author_id` smallint(5) unsigned NOT NULL,
18 `end` date NOT NULL default '0000-00-00',
19 `promos` varchar(255) NOT NULL,
20 `valid` tinyint(1) unsigned NOT NULL default '0',
21 PRIMARY KEY (`survey_id`)
22 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
23
24
25 CREATE TABLE `survey_votes` (
26 `id` smallint(4) unsigned NOT NULL auto_increment,
27 `survey_id` smallint(4) unsigned NOT NULL,
28 `user_id` smallint(5) unsigned NOT NULL,
29 PRIMARY KEY (`id`),
30 UNIQUE KEY `voter` (`survey_id`,`user_id`)
31 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
32
33 # vim: set syntax=mysql: