Skip to content
Browse files

Merged from MOODLE_15_STABLE: (ish, version numbers different): Add a…

…n index where we really need it - block_instance.pagetype
  • Loading branch information...
1 parent f64376b commit c69dbe691e827d8996c8d3dcd72b6edd64b80ecd mjollnir_ committed Sep 2, 2005
Showing with 18 additions and 4 deletions.
  1. +6 −1 blocks/db/mysql.php
  2. +2 −1 blocks/db/mysql.sql
  3. +6 −1 blocks/db/postgres7.php
  4. +3 −0 blocks/db/postgres7.sql
  5. +1 −1 blocks/version.php
View
7 blocks/db/mysql.php
@@ -155,7 +155,12 @@ function blocks_upgrade($oldversion=0) {
PRIMARY KEY(`id`)
) TYPE=MyISAM;");
}
-
+
+ if ($oldversion < 2005090200) {
+ execute_sql("ALTER TABLE {$CFG->prefix}block_instance ADD INDEX pagetype (pagetype);",false); // do it silently, in case it's already there from 1.5
+ modify_database('','ALTER TABLE prefix_block_pinned ADD INDEX pagetype (pagetype);');
+ }
+
//Finally, return result
return $result;
}
View
3 blocks/db/mysql.sql
@@ -24,7 +24,8 @@ CREATE TABLE `prefix_block_instance` (
`visible` tinyint(1) not null default '0',
`configdata` text not null default '',
PRIMARY KEY(`id`),
- INDEX pageid(`pageid`)
+ INDEX pageid(`pageid`),
+ INDEX pagetype(`pagetype`)
) TYPE=MyISAM;
CREATE TABLE `prefix_block_pinned` (
View
7 blocks/db/postgres7.php
@@ -139,7 +139,7 @@ function blocks_upgrade($oldversion=0) {
}
if ($oldversion < 2005022401 && $result) { // Mass cleanup of bad upgrade scripts
- modify_database('','CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid)');
+ execute_sql("CREATE INDEX {$CFG->prefix}block_instance_pageid_idx ON {$CFG->prefix}block_instance (pageid)",false); // this one should be quiet...
modify_database('','ALTER TABLE prefix_block_instance ALTER pagetype SET DEFAULT \'\'');
modify_database('','ALTER TABLE prefix_block_instance ALTER position SET DEFAULT \'\'');
modify_database('','ALTER TABLE prefix_block_instance ALTER pagetype SET NOT NULL');
@@ -158,6 +158,11 @@ function blocks_upgrade($oldversion=0) {
);");
}
+ if ($oldversion < 2005090200) {
+ execute_sql("CREATE INDEX {$CFG->prefix}block_instance_pagetype_idx ON {$CFG->prefix}block_instance (pagetype);",false); // do it silently, in case it's already there from 1.5
+ modify_database('','CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);');
+ }
+
//Finally, return result
return $result;
}
View
3 blocks/db/postgres7.sql
@@ -24,6 +24,7 @@ CREATE TABLE prefix_block_instance (
configdata text not null default ''
) ;
CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid);
+CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (pagetype);
CREATE TABLE prefix_block_pinned (
id SERIAL8 PRIMARY KEY,
@@ -35,4 +36,6 @@ CREATE TABLE prefix_block_pinned (
configdata text NOT NULL default 0
) ;
+CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);
+
# --------------------------------------------------------
View
2 blocks/version.php
@@ -5,4 +5,4 @@
// database (blocks_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
-$blocks_version = 2005081600; // The current version is a date (YYYYMMDDXX)
+$blocks_version = 2005090200; // The current version is a date (YYYYMMDDXX)

0 comments on commit c69dbe6

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