From: gbateson Date: Fri, 1 Sep 2006 04:20:19 +0000 (+0000) Subject: add md5key field to end of hotpot_questions and hotpot_strings X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3044600bf313a406fe651e72e281a148ed94cff5;p=moodle.git add md5key field to end of hotpot_questions and hotpot_strings --- diff --git a/mod/hotpot/db/mysql.sql b/mod/hotpot/db/mysql.sql index f1136ba2d2..eb2725b6c4 100644 --- a/mod/hotpot/db/mysql.sql +++ b/mod/hotpot/db/mysql.sql @@ -66,9 +66,10 @@ CREATE TABLE prefix_hotpot_questions ( type tinyint(4) unsigned NOT NULL default '0', text int(10) unsigned NOT NULL default '0', hotpot int(10) unsigned NOT NULL default '0', + md5key varchar(32) NOT NULL default '', PRIMARY KEY (id), - KEY hotpot_questions_name_idx (name(20)), - KEY hotpot_questions_hotpot_idx (hotpot) + KEY hotpot_questions_hotpot_idx (hotpot), + KEY hotpot_questions_md5key_idx (md5key) ) TYPE=MyISAM COMMENT='details about questions in Hot Potatoes quiz attempts'; # # Table structure for table `hotpot_responses` @@ -95,7 +96,8 @@ CREATE TABLE prefix_hotpot_responses ( CREATE TABLE prefix_hotpot_strings ( id int(10) unsigned NOT NULL auto_increment, string text NOT NULL default '', + md5key varchar(32) NOT NULL default '', PRIMARY KEY (id), - KEY hotpot_strings_string_idx (string(20)) + KEY hotpot_strings_md5key_idx (md5key) ) TYPE=MyISAM COMMENT='strings used in Hot Potatoes questions and responses'; diff --git a/mod/hotpot/db/postgres7.sql b/mod/hotpot/db/postgres7.sql index ceadffd09d..b2fbffd96e 100644 --- a/mod/hotpot/db/postgres7.sql +++ b/mod/hotpot/db/postgres7.sql @@ -74,12 +74,13 @@ CREATE TABLE prefix_hotpot_questions ( name TEXT NOT NULL default '', type INT2 NOT NULL default '0', text INT4 NOT NULL default '0', - hotpot INT4 NOT NULL default '0' + hotpot INT4 NOT NULL default '0', + md5key VARCHAR(32) NOT NULL default '' ); COMMENT ON TABLE prefix_hotpot_questions IS 'details about questions in Hot Potatoes quiz attempts'; CREATE INDEX prefix_hotpot_questions_hotpot_idx ON prefix_hotpot_questions (hotpot); -CREATE INDEX prefix_hotpot_questions_name_idx ON prefix_hotpot_questions (SUBSTR("name",20)); +CREATE INDEX prefix_hotpot_questions_md5key_idx ON prefix_hotpot_questions (md5key); # # Table structure for table `hotpot_responses` @@ -108,9 +109,10 @@ CREATE INDEX prefix_hotpot_responses_question_idx ON prefix_hotpot_responses (qu # CREATE TABLE prefix_hotpot_strings ( - id SERIAL PRIMARY KEY, - string TEXT NOT NULL default '' + id SERIAL PRIMARY KEY, + string TEXT NOT NULL default '', + md5key VARCHAR(32) NOT NULL default '' ); COMMENT ON TABLE prefix_hotpot_strings IS 'strings used in Hot Potatoes questions and responses'; -CREATE INDEX prefix_hotpot_strings_string_idx ON prefix_hotpot_strings (SUBSTR("string",20)); +CREATE INDEX prefix_hotpot_strings_md5key_idx ON prefix_hotpot_strings (md5key); diff --git a/mod/hotpot/db/update_to_v2.php b/mod/hotpot/db/update_to_v2.php index 0e26551ba9..b10c48c789 100644 --- a/mod/hotpot/db/update_to_v2.php +++ b/mod/hotpot/db/update_to_v2.php @@ -15,7 +15,7 @@ function hotpot_update_to_v2_2() { // add new hotpot_questions.md5key field (and index) $table = 'hotpot_questions'; $field = 'md5key'; - $ok = $ok && hotpot_db_update_field_type($table, '', $field, 'VARCHAR', 32, '', 'NOT NULL', '', 'name'); + $ok = $ok && hotpot_db_update_field_type($table, '', $field, 'VARCHAR', 32, '', 'NOT NULL', ''); $ok = $ok && hotpot_db_add_index($table, $field); // add new values hotpot_questions.md5key @@ -38,7 +38,7 @@ function hotpot_update_to_v2_2() { // add new hotpot_strings.md5key field (and index) $table = 'hotpot_strings'; $field = 'md5key'; - $ok = $ok && hotpot_db_update_field_type($table, '', $field, 'VARCHAR', 32, '', 'NOT NULL', '', 'string'); + $ok = $ok && hotpot_db_update_field_type($table, '', $field, 'VARCHAR', 32, '', 'NOT NULL', ''); $ok = $ok && hotpot_db_add_index($table, $field); // add new values hotpot_strings.md5key