Skip to content
Browse files

Indexes for exercise and version bump

  • Loading branch information...
1 parent a12772c commit ee99d4dd14572c87bd5517630fb8748578800331 mjollnir_ committed Nov 18, 2004
View
9 mod/exercise/db/mysql.php
@@ -25,6 +25,15 @@ function exercise_upgrade($oldversion) {
execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `gradingweight`");
}
+ if ($oldversion < 2004111200) {
+ modify_database('','ALTER TABLE prefix_exercise ADD INDEX course (course);');
+ modify_database('','ALTER TABLE prefix_exercise_submissions ADD INDEX exerciseid (exerciseid);');
+ modify_database('','ALTER TABLE prefix_exercise_assessments ADD INDEX exerciseid (exerciseid);');
+ modify_database('','ALTER TABLE prefix_exercise_elements ADD INDEX exerciseid (exerciseid);');
+ modify_database('','ALTER TABLE prefix_exercise_rubrics ADD INDEX exerciseid (exerciseid);');
+ modify_database('','ALTER TABLE prefix_exercise_grades ADD INDEX exerciseid (exerciseid);');
+ }
+
return true;
}
View
18 mod/exercise/db/mysql.sql
@@ -18,7 +18,8 @@ CREATE TABLE `prefix_exercise` (
`grade` tinyint(3) NOT NULL default '0',
`gradinggrade` tinyint(3) NOT NULL default '0',
`showleaguetable` tinyint(3) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `course` (`course`)
) COMMENT='Defines exercise';
# --------------------------------------------------------
@@ -37,7 +38,8 @@ CREATE TABLE `prefix_exercise_submissions` (
`isexercise` tinyint(3) unsigned NOT NULL default '0',
`late` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
- INDEX `userid` (`userid`)
+ INDEX `userid` (`userid`),
+ INDEX `exerciseid` (`exerciseid`)
) COMMENT='Info about submitted work from teacher and students';
# --------------------------------------------------------
@@ -59,7 +61,8 @@ CREATE TABLE `prefix_exercise_assessments` (
`teachercomment` text NOT NULL,
PRIMARY KEY (`id`),
INDEX (`submissionid`),
- INDEX (`userid`)
+ INDEX (`userid`),
+ INDEX (`exerciseid`)
) COMMENT='Info about assessments by teacher and students';
# --------------------------------------------------------
@@ -75,7 +78,8 @@ CREATE TABLE `prefix_exercise_elements` (
`scale` tinyint(3) unsigned NOT NULL default '0',
`maxscore` tinyint(3) unsigned NOT NULL default '1',
`weight` tinyint(3) unsigned NOT NULL default '11',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `exerciseid` (`exerciseid`)
) COMMENT='Info about marking scheme of assignment';
# --------------------------------------------------------
@@ -90,7 +94,8 @@ CREATE TABLE `prefix_exercise_rubrics` (
`elementno` int(10) unsigned NOT NULL default '0',
`rubricno` tinyint(3) unsigned NOT NULL default '0',
`description` text NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `exerciseid` (`exerciseid`)
) COMMENT='Info about the rubrics marking scheme';
# --------------------------------------------------------
@@ -106,7 +111,8 @@ CREATE TABLE `prefix_exercise_grades` (
`feedback` text NOT NULL default '',
`grade` tinyint(3) NOT NULL default '0',
PRIMARY KEY (`id`),
- INDEX (`assessmentid`)
+ INDEX (`assessmentid`),
+ INDEX `exerciseid` (`exerciseid`)
) COMMENT='Info about individual grades given to each element';
# --------------------------------------------------------
View
8 mod/exercise/db/postgres7.php
@@ -15,6 +15,14 @@ function exercise_upgrade($oldversion) {
table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
}
+ if ($oldversion < 2004111200) {
+ modify_database('','CREATE INDEX prefix_exercise_course_idx ON prefix_exercise (course);');
+ modify_database('','CREATE INDEX prefix_exercise_submissions_exerciseid_idx ON prefix_exercise_submissions (exerciseid);');
+ modify_database('','CREATE INDEX prefix_exercise_assessments_exerciseid_idx ON prefix_exercise_assessments (exerciseid);');
+ modify_database('','CREATE INDEX prefix_exercise_rubrics_exerciseid_idx ON prefix_exercise_rubrics (exerciseid);');
+ modify_database('','CREATE INDEX prefix_exercise_grades_exerciseid_idx ON prefix_exercise_grades (exerciseid);');
+ }
+
return true;
}
View
11 mod/exercise/db/postgres7.sql
@@ -19,6 +19,9 @@ CREATE TABLE prefix_exercise (
gradinggrade INT NOT NULL default '0',
showleaguetable INT NOT NULL default '0'
);
+
+CREATE INDEX prefix_exercise_course_idx ON prefix_exercise (course);
+
# --------------------------------------------------------
#
@@ -36,6 +39,8 @@ CREATE TABLE prefix_exercise_submissions (
isexercise INT NOT NULL default '0'
);
CREATE INDEX prefix_exercise_submissions_userid_idx ON prefix_exercise_submissions (userid);
+CREATE INDEX prefix_exercise_submissions_exerciseid_idx ON prefix_exercise_submissions (exerciseid);
+
# --------------------------------------------------------
#
@@ -58,6 +63,7 @@ CREATE TABLE prefix_exercise_assessments (
# --------------------------------------------------------
CREATE INDEX prefix_exercise_assessments_submissionid_idx ON prefix_exercise_assessments (submissionid);
CREATE INDEX prefix_exercise_assessments_userid_idx ON prefix_exercise_assessments (userid);
+CREATE INDEX prefix_exercise_assessments_exerciseid_idx ON prefix_exercise_assessments (exerciseid);
# Table structure for table exercise_elements
#
@@ -85,6 +91,9 @@ CREATE TABLE prefix_exercise_rubrics (
rubricno INT NOT NULL default '0',
description text NOT NULL
);
+
+CREATE INDEX prefix_exercise_rubrics_exerciseid_idx ON prefix_exercise_rubrics (exerciseid);
+
# --------------------------------------------------------
#
@@ -101,6 +110,8 @@ CREATE TABLE prefix_exercise_grades (
);
CREATE INDEX prefix_exercise_grades_assessmentid_idx ON prefix_exercise_grades (assessmentid);
+CREATE INDEX prefix_exercise_grades_exerciseid_idx ON prefix_exercise_grades (exerciseid);
+
# --------------------------------------------------------
View
2 mod/exercise/version.php
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004062300;
+$module->version = 2004111200;
$module->requires = 2004052505; // Requires this Moodle version
$module->cron = 60;

0 comments on commit ee99d4d

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