From: moodler Date: Thu, 21 Aug 2003 08:14:56 +0000 (+0000) Subject: Added an index on courses for the category X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3052e775c8254675723aebe7f3e4a89d7d980d47;p=moodle.git Added an index on courses for the category --- diff --git a/lib/db/mysql.php b/lib/db/mysql.php index e04e423ff6..29244480b5 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -494,6 +494,10 @@ function main_upgrade($oldversion=0) { table_column("course", "", "showgrades", "integer", "2", "unsigned", "1", "", "format"); } + if ($oldversion < 2003082101) { + execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX category (category) "); + } + return $result; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index b634f7f7cb..421793cd85 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -51,7 +51,8 @@ CREATE TABLE `prefix_course` ( `visible` int(10) unsigned NOT NULL default '1', `timecreated` int(10) unsigned NOT NULL default '0', `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `category` (`category`) ) TYPE=MyISAM; # -------------------------------------------------------- diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 4f4f19c6a7..e38fdcb01c 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -238,6 +238,10 @@ function main_upgrade($oldversion=0) { table_column("course", "", "showgrades", "integer", "2", "unsigned", "1", "", "format"); } + if ($oldversion < 2003082101) { + execute_sql(" CREATE INDEX {$CFG->prefix}course_category_idx ON {$CFG->prefix}course (category) "); + } + return $result; } ?> diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 1d45f291b3..a91698bb71 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -30,6 +30,8 @@ CREATE TABLE prefix_course ( timemodified integer NOT NULL default '0' ); +CREATE INDEX prefix_course_category_idx ON prefix_course (category); + CREATE TABLE prefix_course_categories ( id SERIAL PRIMARY KEY, name varchar(255) NOT NULL default ''