Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Indexes and version bump for choice

  • Loading branch information...
commit b53f6cbec484c057b08e671ed553515123798632 1 parent 7bf8395
mjollnir_ authored
6 mod/choice/db/mysql.php
@@ -43,6 +43,12 @@ function choice_upgrade($oldversion) {
43 43 modify_database("", "UPDATE prefix_choice SET publish = publish - 1 WHERE publish > 0;");
44 44 }
45 45
  46 + if ($oldversion < 2004111200){
  47 + modify_database('','ALTER TABLE prefix_choice ADD INDEX course (course);');
  48 + modify_database('','ALTER TABLE prefix_choice_answers ADD INDEX choice (choice);');
  49 + modify_database('','ALTER TABLE prefix_choice_answers ADD INDEX userid (userid);');
  50 +
  51 + }
46 52
47 53 return true;
48 54 }
7 mod/choice/db/mysql.sql
@@ -34,7 +34,8 @@ CREATE TABLE prefix_choice (
34 34 timeclose int(10) unsigned NOT NULL default '0',
35 35 timemodified int(10) unsigned NOT NULL default '0',
36 36 PRIMARY KEY (id),
37   - UNIQUE KEY id (id)
  37 + UNIQUE KEY id (id),
  38 + KEY course (course)
38 39 ) TYPE=MyISAM COMMENT='Available choices are stored here.';
39 40
40 41
@@ -51,7 +52,9 @@ CREATE TABLE prefix_choice_answers (
51 52 answer tinyint(4) NOT NULL default '0',
52 53 timemodified int(10) NOT NULL default '0',
53 54 PRIMARY KEY (id),
54   - UNIQUE KEY id (id)
  55 + UNIQUE KEY id (id),
  56 + KEY userid (userid),
  57 + KEY choice (choice)
55 58 ) TYPE=MyISAM;
56 59
57 60 #
6 mod/choice/db/postgres7.php
@@ -29,6 +29,12 @@ function choice_upgrade($oldversion) {
29 29 modify_database("", "UPDATE prefix_choice SET publish = publish - 1 WHERE publish > 0;");
30 30 }
31 31
  32 + if ($oldversion < 2004111200) {
  33 + modify_database('','CREATE INDEX prefix_choice_course_idx ON prefix_choice (course);');
  34 + modify_database('','CREATE INDEX prefix_choice_answers_choice_idx ON prefix_choice_answers (choice);');
  35 + modify_database('','CREATE INDEX prefix_choice_answers_userid_idx ON prefix_choice_answers (userid);');
  36 + }
  37 +
32 38 return true;
33 39 }
34 40
4 mod/choice/db/postgres7.sql
@@ -35,6 +35,7 @@ CREATE TABLE prefix_choice (
35 35 timemodified integer NOT NULL default '0'
36 36 );
37 37
  38 +CREATE INDEX prefix_choice_course_idx ON prefix_choice (course);
38 39
39 40 # --------------------------------------------------------
40 41
@@ -50,6 +51,9 @@ CREATE TABLE prefix_choice_answers (
50 51 timemodified integer NOT NULL default '0'
51 52 );
52 53
  54 +CREATE INDEX prefix_choice_answers_choice_idx ON prefix_choice_answers (choice);
  55 +CREATE INDEX prefix_choice_answers_userid_idx ON prefix_choice_answers (userid);
  56 +
53 57 #
54 58 # Dumping data for table `log_display`
55 59 #
2  mod/choice/version.php
@@ -5,7 +5,7 @@
5 5 // This fragment is called by /admin/index.php
6 6 ////////////////////////////////////////////////////////////////////////////////
7 7
8   -$module->version = 2004070102;
  8 +$module->version = 2004111200;
9 9 $module->requires = 2004052505; // Requires this Moodle version
10 10 $module->cron = 0;
11 11

0 comments on commit b53f6cb

Please sign in to comment.
Something went wrong with that request. Please try again.