Merged from MOODLE_14_STABLE: Indexes for survey and version bump (honoring partial freeze)

This commit is contained in:
mjollnir_ 2004-11-21 20:43:27 +00:00
parent 59aa644972
commit 5417b5b07a
5 changed files with 50 additions and 4 deletions

View File

@ -177,6 +177,22 @@ function survey_upgrade($oldversion) {
modify_database("", "INSERT INTO prefix_log_display VALUES ('survey', 'update', 'survey', 'name');");
}
if ($oldversion < 2004111200) {
execute_sql("ALTER TABLE {$CFG->prefix}survey DROP INDEX course;",false);
execute_sql("ALTER TABLE {$CFG->prefix}survey_analysis DROP INDEX survey;",false);
execute_sql("ALTER TABLE {$CFG->prefix}survey_analysis DROP INDEX userid;",false);
execute_sql("ALTER TABLE {$CFG->prefix}survey_answers DROP INDEX userid;",false);
execute_sql("ALTER TABLE {$CFG->prefix}survey_answers DROP INDEX survey;",false);
execute_sql("ALTER TABLE {$CFG->prefix}survey_answers DROP INDEX question;",false);
modify_database('','ALTER TABLE prefix_survey ADD INDEX course (course);');
modify_database('','ALTER TABLE prefix_survey_analysis ADD INDEX survey (survey);');
modify_database('','ALTER TABLE prefix_survey_analysis ADD INDEX userid (userid);');
modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX userid (userid);');
modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX survey (survey);');
modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX question (question);');
}
return true;
}

View File

@ -24,7 +24,8 @@ CREATE TABLE prefix_survey (
name varchar(255) NOT NULL default '',
intro text,
questions varchar(255) default NULL,
PRIMARY KEY (id)
PRIMARY KEY (id),
KEY `course` (`course`)
) TYPE=MyISAM COMMENT='all surveys';
#
@ -49,7 +50,9 @@ CREATE TABLE prefix_survey_analysis (
userid int(10) unsigned NOT NULL default '0',
notes text NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id)
UNIQUE KEY id (id),
KEY survey (survey),
KEY userid (userid)
) TYPE=MyISAM;
#
@ -71,7 +74,10 @@ CREATE TABLE prefix_survey_answers (
answer1 text default NULL,
answer2 text default NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id)
UNIQUE KEY id (id),
KEY userid (userid),
KEY survey (survey),
KEY question (question)
) TYPE=MyISAM;
#

View File

@ -24,6 +24,21 @@ function survey_upgrade($oldversion) {
modify_database("", "INSERT INTO prefix_log_display VALUES ('survey', 'update', 'survey', 'name');");
}
if ($oldversion < 2004111200) {
execute_sql("DROP INDEX {$CFG->prefix}survey_course_idx;",false);
execute_sql("DROP INDEX {$CFG->prefix}survey_analysis_survey_idx;",false);
execute_sql("DROP INDEX {$CFG->prefix}survey_analysis_userid_idx;",false);
execute_sql("DROP INDEX {$CFG->prefix}survey_answers_userid_idx;",false);
execute_sql("DROP INDEX {$CFG->prefix}survey_answers_survey_idx;",false);
execute_sql("DROP INDEX {$CFG->prefix}survey_answers_question_idx;",false);
modify_database('','CREATE INDEX prefix_survey_course_idx ON prefix_survey (course);');
modify_database('','CREATE INDEX prefix_survey_analysis_survey_idx ON prefix_survey_analysis (survey);');
modify_database('','CREATE INDEX prefix_survey_analysis_userid_idx ON prefix_survey_analysis (userid);');
modify_database('','CREATE INDEX prefix_survey_answers_userid_idx ON prefix_survey_answers (userid);');
modify_database('','CREATE INDEX prefix_survey_answers_survey_idx ON prefix_survey_answers (survey);');
modify_database('','CREATE INDEX prefix_survey_answers_question_idx ON prefix_survey_answers (question);');
}
return true;
}

View File

@ -26,6 +26,8 @@ CREATE TABLE prefix_survey (
questions varchar(255) default NULL
);
CREATE INDEX prefix_survey_course_idx ON prefix_survey (course);
#
# Dumping data for table survey
#
@ -49,6 +51,9 @@ CREATE TABLE prefix_survey_analysis (
notes text NOT NULL default ''
);
CREATE INDEX prefix_survey_analysis_survey_idx ON prefix_survey_analysis (survey);
CREATE INDEX prefix_survey_analysis_userid_idx ON prefix_survey_analysis (userid);
#
# Dumping data for table survey_analysis
#
@ -69,6 +74,10 @@ CREATE TABLE prefix_survey_answers (
answer2 text default NULL
);
CREATE INDEX prefix_survey_answers_userid_idx ON prefix_survey_answers (userid);
CREATE INDEX prefix_survey_answers_survey_idx ON prefix_survey_answers (survey);
CREATE INDEX prefix_survey_answers_question_idx ON prefix_survey_answers (question);
#
# Dumping data for table survey_answers
#

View File

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004060400;
$module->version = 2004111200;
$module->requires = 2004052505; // Requires this Moodle version
$module->cron = 0;