Permalink
Browse files

Indexes for scorm and version bump (honoring partial freeze)

  • Loading branch information...
1 parent a4f2ce6 commit 37ac5dfdb127fb52c1f866d04464f1c508d5c953 mjollnir_ committed Nov 19, 2004
Showing with 35 additions and 4 deletions.
  1. +9 −0 mod/scorm/db/mysql.php
  2. +8 −3 mod/scorm/db/mysql.sql
  3. +9 −0 mod/scorm/db/postgres7.php
  4. +8 −0 mod/scorm/db/postgres7.sql
  5. +1 −1 mod/scorm/version.php
@@ -26,6 +26,15 @@ function scorm_upgrade($oldversion) {
table_column("scorm", "", "maxgrade", "FLOAT", "3", "", "0", "NOT NULL", "reference");
table_column("scorm", "", "grademethod", "TINYINT", "2", "", "0", "NOT NULL", "maxgrade");
}
+
+ if ($oldversion < 2004083124) {
+ modify_database('','ALTER TABLE prefix_scorm ADD INDEX course (course);');
+ modify_database('','ALTER TABLE prefix_scorm_scoes ADD INDEX scorm (scorm);');
+ modify_database('','ALTER TABLE prefix_scorm_sco_users ADD INDEX scormid (scormid);');
+ modify_database('','ALTER TABLE prefix_scorm_sco_users ADD INDEX userid (userid);');
+ modify_database('','ALTER TABLE prefix_scorm_sco_users ADD INDEX scoid (scoid);');
+ }
+
return true;
}
@@ -16,7 +16,8 @@ CREATE TABLE prefix_scorm (
popup varchar(255) NOT NULL default '',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
- UNIQUE KEY id (id)
+ UNIQUE KEY id (id),
+ KEY course (course)
) TYPE=MyISAM;
CREATE TABLE prefix_scorm_scoes (
@@ -33,7 +34,8 @@ CREATE TABLE prefix_scorm_scoes (
next tinyint(1) unsigned NOT NULL default '0',
previous tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (id),
- UNIQUE KEY id (id)
+ UNIQUE KEY id (id),
+ KEY scorm (scorm)
) TYPE=MyISAM;
CREATE TABLE prefix_scorm_sco_users (
@@ -48,7 +50,10 @@ CREATE TABLE prefix_scorm_sco_users (
cmi_core_session_time varchar(13) NOT NULL default '00:00:00',
cmi_core_score_raw float(3) NOT NULL default '0',
cmi_suspend_data longtext,
- PRIMARY KEY (id)
+ PRIMARY KEY (id),
+ KEY userid (userid),
+ KEY scormid (scormid),
+ KEY scoid (scoid)
) TYPE=MyISAM;
#
@@ -26,6 +26,15 @@ function scorm_upgrade($oldversion) {
table_column("scorm", "", "maxgrade", "real", "3", "", "0", "NOT NULL", "reference");
table_column("scorm", "", "grademethod", "integer", "", "", "0", "NOT NULL", "maxgrade");
}
+
+ if ($oldversion < 2004083124) {
+ modify_database('','CREATE INDEX prefix_scorm_course_idx ON prefix_scorm (course);');
+ modify_database('','CREATE INDEX prefix_scorm_scoes_scorm_idx ON prefix_scorm_scoes (scorm);');
+ modify_database('','CREATE INDEX prefix_scorm_sco_users_userid_idx ON prefix_scorm_sco_users (userid);');
+ modify_database('','CREATE INDEX prefix_scorm_sco_users_scormid_idx ON prefix_scorm_sco_users (scormid);');
+ modify_database('','CREATE INDEX prefix_scorm_sco_users_scoid_idx ON prefix_scorm_sco_users (scoid);');
+ }
+
return true;
}
@@ -17,6 +17,8 @@ CREATE TABLE prefix_scorm (
timemodified integer NOT NULL default '0'
);
+CREATE INDEX prefix_scorm_course_idx ON prefix_scorm (course);
+
CREATE TABLE prefix_scorm_scoes (
id SERIAL PRIMARY KEY,
scorm integer NOT NULL default '0',
@@ -32,6 +34,8 @@ CREATE TABLE prefix_scorm_scoes (
previous integer NOT NULL default '0'
);
+CREATE INDEX prefix_scorm_scoes_scorm_idx ON prefix_scorm_scoes (scorm);
+
CREATE TABLE prefix_scorm_sco_users (
id SERIAL PRIMARY KEY,
userid integer NOT NULL default '0',
@@ -46,6 +50,10 @@ CREATE TABLE prefix_scorm_sco_users (
cmi_suspend_data text NOT NULL default ''
);
+CREATE INDEX prefix_scorm_sco_users_userid_idx ON prefix_scorm_sco_users (userid);
+CREATE INDEX prefix_scorm_sco_users_scormid_idx ON prefix_scorm_sco_users (scormid);
+CREATE INDEX prefix_scorm_sco_users_scoid_idx ON prefix_scorm_sco_users (scoid);
+
#
# Dumping data for table `log_display`
#
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004083123; // The (date) version of this module
+$module->version = 2004083124; // The (date) version of this module
$module->requires = 2004083123; // The version of Moodle that is required
$module->cron = 0; // How often should cron check this module (seconds)?

0 comments on commit 37ac5df

Please sign in to comment.