Skip to content
Browse files

Add an index where we really need it - block_instance.pagetype

  • Loading branch information...
1 parent 73d68a0 commit c6a37a3185aad6359ed2f1cc7aab0327721e4614 mjollnir_ committed Sep 2, 2005
Showing with 15 additions and 3 deletions.
  1. +5 −0 blocks/db/mysql.php
  2. +2 −1 blocks/db/mysql.sql
  3. +6 −1 blocks/db/postgres7.php
  4. +1 −0 blocks/db/postgres7.sql
  5. +1 −1 blocks/version.php
View
5 blocks/db/mysql.php
@@ -143,6 +143,11 @@ function blocks_upgrade($oldversion=0) {
}
}
+ if ($oldversion < 2005022401) {
+ // add an index where we really need it
+ modify_database('','ALTER TABLE prefix_block_instance ADD INDEX pagetype (pagetype);');
+ }
+
//Finally, return result
return $result;
}
View
3 blocks/db/mysql.sql
@@ -24,6 +24,7 @@ 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;
# --------------------------------------------------------
View
7 blocks/db/postgres7.php
@@ -139,13 +139,18 @@ 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');
modify_database('','ALTER TABLE prefix_block_instance ALTER position SET NOT NULL');
}
+ if ($oldversion < 2005022401) {
+ // add an index where we really need it
+ modify_database('','CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (pagetype);');
+ }
+
//Finally, return result
return $result;
}
View
1 blocks/db/postgres7.sql
@@ -25,5 +25,6 @@ CREATE TABLE prefix_block_instance (
) ;
CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid);
+CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (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 = 2005022400; // The current version is a date (YYYYMMDDXX)
+$blocks_version = 2005022401; // The current version is a date (YYYYMMDDXX)

0 comments on commit c6a37a3

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