Permalink
Browse files

Indexes and version bump for assignment

  • Loading branch information...
1 parent 602c150 commit f3f9ab2a5eb7fc5bac6913f903fe642f8985e611 mjollnir_ committed Nov 17, 2004
@@ -99,6 +99,14 @@ function assignment_upgrade($oldversion) {
assignment_refresh_events();
}
+ if ($oldversion < 2004111200) {
+ modify_database('','ALTER TABLE prefix_assignment ADD INDEX course (course);');
+ modify_database('','ALTER TABLE prefix_assignment_submissions ADD INDEX assignment(assignment);');
+ modify_database('','ALTER TABLE prefix_assignment_submissions ADD INDEX userid (userid);');
+ modify_database('','ALTER TABLE prefix_assignment_submissions ADD INDEX mailed (mailed);');
+ modify_database('','ALTER TABLE prefix_assignment_submissions ADD INDEX timemarked (timemarked);');
+ }
+
return true;
}
@@ -14,7 +14,8 @@ CREATE TABLE `prefix_assignment` (
`timedue` int(10) unsigned NOT NULL default '0',
`grade` int(10) NOT NULL default '0',
`timemodified` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `course` (`course`)
) COMMENT='Defines assignments';
# --------------------------------------------------------
@@ -34,7 +35,11 @@ CREATE TABLE `prefix_assignment_submissions` (
`teacher` int(10) unsigned NOT NULL default '0',
`timemarked` int(10) unsigned NOT NULL default '0',
`mailed` tinyint(1) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `assignment` (`assignment`),
+ KEY `userid` (`userid`),
+ KEY `mailed` (`mailed`),
+ KEY `timemarked` (`timemarked`)
) COMMENT='Info about submitted assignments';
# --------------------------------------------------------
@@ -97,6 +97,14 @@ function assignment_upgrade($oldversion) {
assignment_refresh_events();
}
+ if ($oldversion < 2004111200) {
+ modify_database('','CREATE INDEX prefix_assignment_course_idx ON prefix_assignment (course);');
+ modify_database('','CREATE INDEX prefix_assignment_submissions_assignment_idx ON prefix_assignment_submissions (assignment);');
+ modify_database('','CREATE INDEX prefix_assignment_submissions_userid_idx ON prefix_assignment_submissions (userid);');
+ modify_database('','CREATE INDEX prefix_assignment_submissions_mailed_idx ON prefix_assignment_submissions (mailed);');
+ modify_database('','CREATE INDEX prefix_assignment_submissions_timemarked_idx ON prefix_assignment_submissions (timemarked);');
+ }
+
return true;
}
@@ -15,6 +15,9 @@ CREATE TABLE prefix_assignment (
grade integer NOT NULL default '0',
timemodified integer NOT NULL default '0'
);
+
+CREATE INDEX prefix_assignment_course_idx ON prefix_assignment (course);
+
# --------------------------------------------------------
#
@@ -34,6 +37,13 @@ CREATE TABLE prefix_assignment_submissions (
timemarked integer NOT NULL default '0',
mailed integer NOT NULL default '0'
);
+
+CREATE INDEX prefix_assignment_submissions_assignment_idx ON prefix_assignment_submissions (assignment);
+CREATE INDEX prefix_assignment_submissions_userid_idx ON prefix_assignment_submissions (userid);
+CREATE INDEX prefix_assignment_submissions_mailed_idx ON prefix_assignment_submissions (mailed);
+CREATE INDEX prefix_assignment_submissions_timemarked_idx ON prefix_assignment_submissions (timemarked);
+
+
# --------------------------------------------------------
@@ -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 = 60;

0 comments on commit f3f9ab2

Please sign in to comment.