Permalink
Browse files

Indexes and version bump for choice

  • Loading branch information...
1 parent 7bf8395 commit b53f6cbec484c057b08e671ed553515123798632 mjollnir_ committed Nov 17, 2004
Showing with 22 additions and 3 deletions.
  1. +6 −0 mod/choice/db/mysql.php
  2. +5 −2 mod/choice/db/mysql.sql
  3. +6 −0 mod/choice/db/postgres7.php
  4. +4 −0 mod/choice/db/postgres7.sql
  5. +1 −1 mod/choice/version.php
View
@@ -43,6 +43,12 @@ function choice_upgrade($oldversion) {
modify_database("", "UPDATE prefix_choice SET publish = publish - 1 WHERE publish > 0;");
}
+ if ($oldversion < 2004111200){
+ modify_database('','ALTER TABLE prefix_choice ADD INDEX course (course);');
+ modify_database('','ALTER TABLE prefix_choice_answers ADD INDEX choice (choice);');
+ modify_database('','ALTER TABLE prefix_choice_answers ADD INDEX userid (userid);');
+
+ }
return true;
}
View
@@ -34,7 +34,8 @@ CREATE TABLE prefix_choice (
timeclose int(10) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
- UNIQUE KEY id (id)
+ UNIQUE KEY id (id),
+ KEY course (course)
) TYPE=MyISAM COMMENT='Available choices are stored here.';
@@ -51,7 +52,9 @@ CREATE TABLE prefix_choice_answers (
answer tinyint(4) NOT NULL default '0',
timemodified int(10) NOT NULL default '0',
PRIMARY KEY (id),
- UNIQUE KEY id (id)
+ UNIQUE KEY id (id),
+ KEY userid (userid),
+ KEY choice (choice)
) TYPE=MyISAM;
#
@@ -29,6 +29,12 @@ function choice_upgrade($oldversion) {
modify_database("", "UPDATE prefix_choice SET publish = publish - 1 WHERE publish > 0;");
}
+ if ($oldversion < 2004111200) {
+ modify_database('','CREATE INDEX prefix_choice_course_idx ON prefix_choice (course);');
+ modify_database('','CREATE INDEX prefix_choice_answers_choice_idx ON prefix_choice_answers (choice);');
+ modify_database('','CREATE INDEX prefix_choice_answers_userid_idx ON prefix_choice_answers (userid);');
+ }
+
return true;
}
@@ -35,6 +35,7 @@ CREATE TABLE prefix_choice (
timemodified integer NOT NULL default '0'
);
+CREATE INDEX prefix_choice_course_idx ON prefix_choice (course);
# --------------------------------------------------------
@@ -50,6 +51,9 @@ CREATE TABLE prefix_choice_answers (
timemodified integer NOT NULL default '0'
);
+CREATE INDEX prefix_choice_answers_choice_idx ON prefix_choice_answers (choice);
+CREATE INDEX prefix_choice_answers_userid_idx ON prefix_choice_answers (userid);
+
#
# Dumping data for table `log_display`
#
View
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004070102;
+$module->version = 2004111200;
$module->requires = 2004052505; // Requires this Moodle version
$module->cron = 0;

0 comments on commit b53f6cb

Please sign in to comment.