Permalink
Browse files

Merged from MOODLE_14_STABLE: Indexes for scorm and version bump (hon…

…oring partial freeze)
  • Loading branch information...
mjollnir_
mjollnir_ committed Nov 19, 2004
1 parent a5e2b34 commit 7e0286af89af6b49b013c69f9cb326d533ca9474
Showing with 47 additions and 4 deletions.
  1. +15 −0 mod/scorm/db/mysql.php
  2. +8 −3 mod/scorm/db/mysql.sql
  3. +15 −0 mod/scorm/db/postgres7.php
  4. +8 −0 mod/scorm/db/postgres7.sql
  5. +1 −1 mod/scorm/version.php
View
@@ -26,6 +26,21 @@ 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 < 2004111200) {
+ execute_sql("ALTER TABLE {$CFG->prefix}scorm DROP INDEX course;",false);
+ execute_sql("ALTER TABLE {$CFG->prefix}scorm_scoes DROP INDEX scorm;",false);
+ execute_sql("ALTER TABLE {$CFG->prefix}scorm_sco_users DROP INDEX scormid;",false);
+ execute_sql("ALTER TABLE {$CFG->prefix}scorm_sco_users DROP INDEX userid;",false);
+ execute_sql("ALTER TABLE {$CFG->prefix}scorm_sco_users DROP INDEX scoid;",false);
+
+ 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;
}
View
@@ -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;
#
View
@@ -26,6 +26,21 @@ 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 < 2004111200) {
+ execute_sql("DROP INDEX {$CFG->prefix}scorm_course_idx;",false);
+ execute_sql("DROP INDEX {$CFG->prefix}scorm_scoes_scorm_idx;",false);
+ execute_sql("DROP INDEX {$CFG->prefix}scorm_sco_users_userid_idx;",false);
+ execute_sql("DROP INDEX {$CFG->prefix}scorm_sco_users_scormid_idx;",false);
+ execute_sql("DROP INDEX {$CFG->prefix}scorm_sco_users_scoid_idx;",false);
+
+ 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`
#
View
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004110200; // The (date) version of this module
+$module->version = 2004111200; // The (date) version of this module
$module->requires = 2004110200; // The version of Moodle that is required
$module->cron = 0; // How often should cron check this module (seconds)?

0 comments on commit 7e0286a

Please sign in to comment.