Indexes for quiz and version bump (honoring partial freeze)
This commit is contained in:
@@ -266,6 +266,16 @@ function quiz_upgrade($oldversion) {
|
||||
KEY `question` (`question`)
|
||||
) TYPE=MyISAM COMMENT='Options for questions of type calculated'; ");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004073002) {
|
||||
modify_database('','ALTER TABLE prefix_quiz ADD INDEX course (course);');
|
||||
modify_database('','ALTER TABLE prefix_quiz_calculated ADD INDEX answer (answer);');
|
||||
modify_database('','ALTER TABLE prefix_quiz_categories ADD INDEX course (course);');
|
||||
modify_database('','ALTER TABLE prefix_quiz_dataset_definitions ADD INDEX category (category);');
|
||||
modify_database('','ALTER TABLE prefix_quiz_numerical ADD INDEX question (question);');
|
||||
modify_database('','ALTER TABLE prefix_quiz_numerical_units ADD INDEX question (question);');
|
||||
modify_database('','ALTER TABLE prefix_quiz_questions ADD INDEX category (category);');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+14
-7
@@ -36,7 +36,8 @@ CREATE TABLE `prefix_quiz` (
|
||||
`timelimit` int(2) unsigned NOT NULL default '0',
|
||||
`password` varchar(255) NOT NULL default '',
|
||||
`subnet` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `course` (`course`)
|
||||
) TYPE=MyISAM COMMENT='Main information about each quiz';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -100,7 +101,8 @@ CREATE TABLE `prefix_quiz_calculated` (
|
||||
`tolerancetype` int(10) NOT NULL default '1',
|
||||
`correctanswerlength` int(10) NOT NULL default '2',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `question` (`question`)
|
||||
KEY `question` (`question`),
|
||||
KEY `answer` (`answer`)
|
||||
) TYPE=MyISAM COMMENT='Options for questions of type calculated';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -115,7 +117,8 @@ CREATE TABLE `prefix_quiz_categories` (
|
||||
`info` text NOT NULL,
|
||||
`publish` tinyint(4) NOT NULL default '0',
|
||||
`stamp` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `course` (`course`)
|
||||
) TYPE=MyISAM COMMENT='Categories are for grouping questions';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -130,7 +133,8 @@ CREATE TABLE `prefix_quiz_dataset_definitions` (
|
||||
`type` int(10) NOT NULL default '0',
|
||||
`options` varchar(255) NOT NULL default '',
|
||||
`itemcount` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `category` (`category`)
|
||||
) TYPE=MyISAM COMMENT='Organises and stores properties for dataset items';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -233,7 +237,8 @@ CREATE TABLE `prefix_quiz_numerical` (
|
||||
`min` varchar(255) NOT NULL default '',
|
||||
`max` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `answer` (`answer`)
|
||||
KEY `answer` (`answer`),
|
||||
KEY `question` (`question`)
|
||||
) TYPE=MyISAM COMMENT='Options for numerical questions';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -246,7 +251,8 @@ CREATE TABLE `prefix_quiz_numerical_units` (
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
`multiplier` decimal(40,20) NOT NULL default '1.00000000000000000000',
|
||||
`unit` varchar(50) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `question` (`question`)
|
||||
) TYPE=MyISAM COMMENT='Optional unit options for numerical questions';
|
||||
# --------------------------------------------------------
|
||||
|
||||
@@ -293,7 +299,8 @@ CREATE TABLE `prefix_quiz_questions` (
|
||||
`qtype` smallint(6) NOT NULL default '0',
|
||||
`stamp` varchar(255) NOT NULL default '',
|
||||
`version` int(10) NOT NULL default '1',
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `category` (`category`)
|
||||
) TYPE=MyISAM COMMENT='The quiz questions themselves';
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
@@ -224,7 +224,27 @@ function quiz_upgrade($oldversion) {
|
||||
|
||||
modify_database ( "", "COMMIT;");
|
||||
}
|
||||
|
||||
|
||||
if ($oldversion < 2004073002) {
|
||||
modify_database('','CREATE INDEX prefix_quiz_course_idx ON prefix_quiz (course);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_answers_question_idx ON prefix_quiz_answers (question);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_attempts_quiz_idx ON prefix_quiz_attempts (quiz);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_attempts_userid_idx ON prefix_quiz_attempts (userid);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_calculated_answer_idx ON prefix_quiz_calculated (answer);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_categories_course_idx ON prefix_quiz_categories (course);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_dataset_definitions_category_idx ON prefix_quiz_dataset_definitions (category);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_numerical_question_idx ON prefix_quiz_numerical (question);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_numerical_units_question_idx ON prefix_quiz_numerical_units (question);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_question_grades_quiz_idx ON prefix_quiz_question_grades (quiz);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_question_grades_question_idx ON prefix_quiz_question_grades (question);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_questions_category_idx ON prefix_quiz_questions (category);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_randomsamatch_question_idx ON prefix_quiz_randomsamatch (question);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_responses_attempt_idx ON prefix_quiz_responses (attempt);');
|
||||
modify_database('','CREATE INDEX prefix_quiz_responses_question_idx ON prefix_quiz_responses (question);');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ CREATE TABLE prefix_quiz (
|
||||
password varchar(255) NOT NULL default '',
|
||||
subnet varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_course_idx ON prefix_quiz (course);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -50,6 +53,9 @@ CREATE TABLE prefix_quiz_answers (
|
||||
fraction varchar(10) NOT NULL default '0.0',
|
||||
feedback text NOT NULL default ''
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_answers_question_idx ON prefix_quiz_answers (question);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -66,6 +72,10 @@ CREATE TABLE prefix_quiz_attempts (
|
||||
timefinish integer NOT NULL default '0',
|
||||
timemodified integer NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_attempts_quiz_idx ON prefix_quiz_attempts (quiz);
|
||||
CREATE INDEX prefix_quiz_attempts_userid_idx ON prefix_quiz_attempts (userid);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -80,6 +90,9 @@ CREATE TABLE prefix_quiz_categories (
|
||||
publish integer NOT NULL default '0',
|
||||
stamp varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_categories_course_idx ON prefix_quiz_categories (course);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -93,6 +106,10 @@ CREATE TABLE prefix_quiz_grades (
|
||||
grade varchar(10) NOT NULL default '0.0',
|
||||
timemodified integer NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz);
|
||||
CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -162,6 +179,7 @@ CREATE TABLE prefix_quiz_numerical (
|
||||
);
|
||||
# --------------------------------------------------------
|
||||
CREATE INDEX prefix_quiz_numerical_answer_idx ON prefix_quiz_numerical (answer);
|
||||
CREATE INDEX prefix_quiz_numerical_question_idx ON prefix_quiz_numerical (question);
|
||||
|
||||
#
|
||||
# Table structure for table quiz_question_grades
|
||||
@@ -173,6 +191,10 @@ CREATE TABLE prefix_quiz_question_grades (
|
||||
question integer NOT NULL default '0',
|
||||
grade integer NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_question_grades_quiz_idx ON prefix_quiz_question_grades (quiz);
|
||||
CREATE INDEX prefix_quiz_question_grades_question_idx ON prefix_quiz_question_grades (question);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -191,6 +213,9 @@ CREATE TABLE prefix_quiz_questions (
|
||||
stamp varchar(255) NOT NULL default '',
|
||||
version integer NOT NULL default '1'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_questions_category_idx ON prefix_quiz_questions (category);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -203,6 +228,8 @@ CREATE TABLE prefix_quiz_randomsamatch (
|
||||
choose integer NOT NULL default '4'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_randomsamatch_question_idx ON prefix_quiz_randomsamatch (question);
|
||||
|
||||
#
|
||||
# Table structure for table quiz_responses
|
||||
#
|
||||
@@ -214,6 +241,10 @@ CREATE TABLE prefix_quiz_responses (
|
||||
answer varchar(255) NOT NULL default '',
|
||||
grade varchar(10) NOT NULL default '0.0'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_responses_attempt_idx ON prefix_quiz_responses (attempt);
|
||||
CREATE INDEX prefix_quiz_responses_question_idx ON prefix_quiz_responses (question);
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
@@ -250,6 +281,7 @@ CREATE TABLE prefix_quiz_numerical_units (
|
||||
unit varchar(50) NOT NULL default ''
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_numerical_units_question_idx ON prefix_quiz_numerical_units (question);
|
||||
|
||||
CREATE TABLE prefix_quiz_attemptonlast_datasets (
|
||||
id SERIAL8 PRIMARY KEY,
|
||||
@@ -268,6 +300,8 @@ CREATE TABLE prefix_quiz_dataset_definitions (
|
||||
itemcount INT8 NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_quiz_dataset_definitions_category_idx ON prefix_quiz_dataset_definitions (category);
|
||||
|
||||
CREATE TABLE prefix_quiz_dataset_items (
|
||||
id SERIAL8 PRIMARY KEY,
|
||||
definition INT8 NOT NULL default '0',
|
||||
@@ -298,7 +332,7 @@ CREATE TABLE prefix_quiz_calculated (
|
||||
|
||||
CREATE INDEX prefix_quiz_calculated_question_idx
|
||||
ON prefix_quiz_calculated (question);
|
||||
|
||||
CREATE INDEX prefix_quiz_calculated_answer_idx ON prefix_quiz_calculated (answer);
|
||||
|
||||
|
||||
INSERT INTO prefix_log_display VALUES ('quiz', 'add', 'quiz', 'name');
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2004073001; // The (date) version of this module
|
||||
$module->version = 2004073002; // The (date) version of this module
|
||||
$module->requires = 2004082300; // Requires this Moodle version
|
||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user