From ba1c4fe82e34d56a8e2e1f5014d77fbe039d7bfb Mon Sep 17 00:00:00 2001 From: "Ap.Muthu" Date: Sun, 13 Jul 2014 18:12:13 +0530 Subject: [PATCH] Cleaned up the mysql base file --- installer/sql/create-mysql.sql | 148 +++++++++++++++++---------------- 1 file changed, 76 insertions(+), 72 deletions(-) diff --git a/installer/sql/create-mysql.sql b/installer/sql/create-mysql.sql index a9d52263c71..ead3a2bc8a8 100644 --- a/installer/sql/create-mysql.sql +++ b/installer/sql/create-mysql.sql @@ -9,7 +9,7 @@ CREATE TABLE `prefix_answers` ( `assessment_value` int(11) NOT NULL default '0', `language` varchar(20) default 'en', `scale_id` int(11) NOT NULL default '0', - PRIMARY KEY (`qid`,`code`,`language`,`scale_id`) + PRIMARY KEY (`qid`,`code`,`language`,`scale_id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -26,8 +26,8 @@ CREATE TABLE `prefix_assessments` ( `maximum` varchar(50) NOT NULL default '', `message` text NOT NULL, `language` varchar(20) NOT NULL default 'en', - PRIMARY KEY (`id`,`language`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`id`,`language`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -41,8 +41,8 @@ CREATE TABLE `prefix_conditions` ( `method` varchar(5) NOT NULL default '', `value` varchar(255) NOT NULL default '', `scenario` int(11) NOT NULL default '1', - PRIMARY KEY (`cid`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`cid`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -55,7 +55,7 @@ CREATE TABLE `prefix_defaultvalues` ( `language` varchar(20) NOT NULL, `specialtype` varchar(20) NOT NULL default '', `defaultvalue` text, - PRIMARY KEY (`qid` , `specialtype`, `language`, `scale_id`, `sqid` ) + PRIMARY KEY (`qid`, `specialtype`, `language`, `scale_id`, `sqid`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -70,7 +70,7 @@ CREATE TABLE `prefix_expression_errors` ( `qid` int(11) DEFAULT NULL, `gseq` int(11) DEFAULT NULL, `qseq` int(11) DEFAULT NULL, - `type` varchar(50) , + `type` varchar(50), `eqn` text, `prettyprint` text, PRIMARY KEY (`id`) @@ -101,8 +101,8 @@ CREATE TABLE `prefix_groups` ( `language` varchar(20) default 'en', `randomization_group` varchar(20) NOT NULL default '', `grelevance` text DEFAULT NULL, - PRIMARY KEY (`gid`,`language`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`gid`,`language`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -115,7 +115,7 @@ CREATE TABLE `prefix_labels` ( `sortorder` int(11) NOT NULL, `language` varchar(20) default 'en', `assessment_value` int(11) NOT NULL default '0', - PRIMARY KEY (`lid`,`sortorder`,`language`), + PRIMARY KEY (`lid`,`sortorder`,`language`), KEY `labels_code_idx` (`code`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -127,8 +127,8 @@ CREATE TABLE `prefix_labelsets` ( `lid` int(11) NOT NULL auto_increment, `label_name` varchar(100) NOT NULL default '', `languages` varchar(200) default 'en', - PRIMARY KEY (`lid`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`lid`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -138,7 +138,7 @@ CREATE TABLE `prefix_participant_attribute` ( `participant_id` varchar(50) NOT NULL, `attribute_id` int(11) NOT NULL, `value` text NOT NULL, - PRIMARY KEY (`participant_id`,`attribute_id`) + PRIMARY KEY (`participant_id`,`attribute_id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -149,7 +149,7 @@ CREATE TABLE `prefix_participant_attribute_names_lang` ( `attribute_id` int(11) NOT NULL, `attribute_name` varchar(30) NOT NULL, `lang` varchar(255) NOT NULL, - PRIMARY KEY (`attribute_id`,`lang`) + PRIMARY KEY (`attribute_id`,`lang`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -161,7 +161,7 @@ CREATE TABLE `prefix_participant_attribute_names` ( `attribute_type` varchar(4) NOT NULL, `defaultname` varchar(50) NOT NULL, `visible` varchar(5) NOT NULL, - PRIMARY KEY (`attribute_id`,`attribute_type`) + PRIMARY KEY (`attribute_id`,`attribute_type`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -172,7 +172,7 @@ CREATE TABLE `prefix_participant_attribute_values` ( `value_id` int(11) NOT NULL AUTO_INCREMENT, `attribute_id` int(11) NOT NULL, `value` text NOT NULL, - PRIMARY KEY ( `value_id`) + PRIMARY KEY (`value_id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -184,7 +184,7 @@ CREATE TABLE `prefix_participant_shares` ( `share_uid` int(11) NOT NULL, `date_added` datetime NOT NULL, `can_edit` varchar(5) NOT NULL, - PRIMARY KEY (`participant_id`,`share_uid`) + PRIMARY KEY (`participant_id`,`share_uid`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -202,7 +202,7 @@ CREATE TABLE `prefix_participants` ( `created_by` int(11) NOT NULL, `created` datetime, `modified` datetime, - PRIMARY KEY (`participant_id`) + PRIMARY KEY (`participant_id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -210,19 +210,19 @@ CREATE TABLE `prefix_participants` ( -- Table structure for table permissions -- CREATE TABLE `prefix_permissions` ( - `id` int(11) NOT NULL auto_increment, - `entity` varchar(50) NOT NULL, - `entity_id` int(11) NOT NULL, - `uid` int(11) NOT NULL, - `permission` varchar(100) NOT NULL, - `create_p` int(11) NOT NULL default '0', - `read_p` int(11) NOT NULL default '0', - `update_p` int(11) NOT NULL default '0', - `delete_p` int(11) NOT NULL default '0', - `import_p` int(11) NOT NULL default '0', - `export_p` int(11) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY `idxPermissions` (`entity_id`,`entity`,`permission`,`uid`) + `id` int(11) NOT NULL auto_increment, + `entity` varchar(50) NOT NULL, + `entity_id` int(11) NOT NULL, + `uid` int(11) NOT NULL, + `permission` varchar(100) NOT NULL, + `create_p` int(11) NOT NULL default '0', + `read_p` int(11) NOT NULL default '0', + `update_p` int(11) NOT NULL default '0', + `delete_p` int(11) NOT NULL default '0', + `import_p` int(11) NOT NULL default '0', + `export_p` int(11) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `idxPermissions` (`entity_id`,`entity`,`permission`,`uid`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -233,7 +233,7 @@ CREATE TABLE `prefix_plugins` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL, `active` int(1) NOT NULL default '0', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -247,8 +247,8 @@ CREATE TABLE `prefix_plugin_settings` ( `model_id` int(11) NULL, `key` varchar(50) NOT NULL, `value` text NULL, - PRIMARY KEY (`id`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`id`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -260,8 +260,8 @@ CREATE TABLE `prefix_question_attributes` ( `attribute` varchar(50) default NULL, `value` text default NULL, `language` varchar(20) default NULL, - PRIMARY KEY (`qaid`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`qaid`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -284,8 +284,8 @@ CREATE TABLE `prefix_questions` ( `scale_id` int(11) NOT NULL default '0', `same_default` int(11) NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog', `relevance` text, - PRIMARY KEY (`language`, `qid`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`language`, `qid`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -299,8 +299,8 @@ CREATE TABLE `prefix_quota` ( `action` int(11) default NULL, `active` int(11) NOT NULL default '1', `autoload_url` int(11) NOT NULL default '0', - PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`id`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -315,7 +315,7 @@ CREATE TABLE `prefix_quota_languagesettings` ( `quotals_url` varchar(255), `quotals_urldescrip` varchar(255), PRIMARY KEY (`quotals_id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -327,9 +327,9 @@ CREATE TABLE `prefix_quota_members` ( `qid` int(11) default NULL, `quota_id` int(11) default NULL, `code` varchar(11) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`id`), + PRIMARY KEY (`id`), UNIQUE KEY `sid` (`sid`,`qid`,`quota_id`,`code`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -347,18 +347,18 @@ CREATE TABLE `prefix_saved_control` ( `status` varchar(1) NOT NULL default '', `saved_date` datetime NOT NULL, `refurl` text, - PRIMARY KEY (`scid`) -) ENGINE=MYISAM AUTO_INCREMENT=1 CHARACTER SET utf8 COLLATE utf8_unicode_ci; + PRIMARY KEY (`scid`) +) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- -- Table structure for table sessions -- CREATE TABLE `prefix_sessions`( - `id` varchar(32) NOT NULL, - `expire` int(11) DEFAULT NULL, - `data` longblob, - PRIMARY KEY (`id`) + `id` varchar(32) NOT NULL, + `expire` int(11) DEFAULT NULL, + `data` longblob, + PRIMARY KEY (`id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -368,7 +368,7 @@ CREATE TABLE `prefix_sessions`( CREATE TABLE `prefix_settings_global` ( `stg_name` varchar(50) NOT NULL default '', `stg_value` varchar(255) NOT NULL default '', - PRIMARY KEY (`stg_name`) + PRIMARY KEY (`stg_name`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -382,7 +382,7 @@ CREATE TABLE `prefix_survey_links` ( `date_created` datetime, `date_invited` datetime, `date_completed` datetime, - PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) + PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -390,12 +390,12 @@ CREATE TABLE `prefix_survey_links` ( -- Table structure for table survey_url_parameters -- CREATE TABLE `prefix_survey_url_parameters` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `sid` int(11) NOT NULL, - `parameter` varchar(50) NOT NULL, - `targetqid` int(11) NULL, - `targetsqid` int(11) NULL, - PRIMARY KEY (`id`) + `id` int(11) NOT NULL AUTO_INCREMENT, + `sid` int(11) NOT NULL, + `parameter` varchar(50) NOT NULL, + `targetqid` int(11) NULL, + `targetsqid` int(11) NULL, + PRIMARY KEY (`id`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -461,7 +461,7 @@ CREATE TABLE `prefix_surveys` ( `alloweditaftercompletion` varchar(1) default 'N', `googleanalyticsstyle` varchar(1) DEFAULT NULL, `googleanalyticsapikey` VARCHAR(25) DEFAULT NULL, - PRIMARY KEY(`sid`) + PRIMARY KEY (`sid`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -470,7 +470,7 @@ CREATE TABLE `prefix_surveys` ( -- CREATE TABLE `prefix_surveys_languagesettings` ( `surveyls_survey_id` int(11) NOT NULL, - `surveyls_language` varchar(45) NULL DEFAULT 'en', + `surveyls_language` varchar(45) NOT NULL DEFAULT 'en', `surveyls_title` varchar(200) NOT NULL, `surveyls_description` TEXT NULL, `surveyls_welcometext` TEXT NULL, @@ -487,7 +487,7 @@ CREATE TABLE `prefix_surveys_languagesettings` ( `surveyls_email_confirm` TEXT NULL, `surveyls_dateformat` int(11) NOT NULL DEFAULT 1, `surveyls_attributecaptions` TEXT NULL, - `email_admin_notification_subj` varchar(255) NULL, + `email_admin_notification_subj` varchar(255) NULL, `email_admin_notification` TEXT NULL, `email_admin_responses_subj` varchar(255) NULL, `email_admin_responses` TEXT NULL, @@ -501,10 +501,12 @@ CREATE TABLE `prefix_surveys_languagesettings` ( -- Table structure for table user_groups -- CREATE TABLE `prefix_user_groups` ( - `ugid` int(11) NOT NULL auto_increment PRIMARY KEY, - `name` varchar(20) NOT NULL UNIQUE, - `description` TEXT NOT NULL, - `owner_id` int(11) NOT NULL + `ugid` int(11) NOT NULL auto_increment, + `name` varchar(20) NOT NULL, + `description` TEXT NOT NULL, + `owner_id` int(11) NOT NULL, + PRIMARY KEY (`ugid`), + UNIQUE KEY `lug_name` (`name`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -512,9 +514,9 @@ CREATE TABLE `prefix_user_groups` ( -- Table structure for table user_in_groups -- CREATE TABLE `prefix_user_in_groups` ( - `ugid` int(11) NOT NULL, - `uid` int(11) NOT NULL, - PRIMARY KEY (`ugid`,`uid`) + `ugid` int(11) NOT NULL, + `uid` int(11) NOT NULL, + PRIMARY KEY (`ugid`,`uid`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -522,8 +524,8 @@ CREATE TABLE `prefix_user_in_groups` ( -- Table structure for table users -- CREATE TABLE `prefix_users` ( - `uid` int(11) NOT NULL auto_increment PRIMARY KEY, - `users_name` varchar(64) NOT NULL UNIQUE default '', + `uid` int(11) NOT NULL auto_increment, + `users_name` varchar(64) NOT NULL default '', `password` BLOB NOT NULL, `full_name` varchar(50) NOT NULL, `parent_id` int(11) NOT NULL, @@ -533,9 +535,11 @@ CREATE TABLE `prefix_users` ( `templateeditormode` varchar(7) NOT NULL default 'default', `questionselectormode` varchar(7) NOT NULL default 'default', `one_time_pw` BLOB, - `dateformat` INT NOT NULL DEFAULT 1, + `dateformat` INT(11) NOT NULL DEFAULT 1, `created` datetime, - `modified` datetime + `modified` datetime, + PRIMARY KEY (`uid`), + UNIQUE KEY `users_name` (`users_name`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -545,7 +549,7 @@ CREATE TABLE `prefix_users` ( CREATE TABLE `prefix_templates` ( `folder` varchar(255) NOT NULL, `creator` int(11) NOT NULL, - PRIMARY KEY (`folder`) + PRIMARY KEY (`folder`) ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;