Merged from MOODLE_15_STABLE: (ish, version numbers different): Add an index where we really need it - block_instance.pagetype

This commit is contained in:
mjollnir_ 2005-09-02 05:00:59 +00:00
parent f64376bfc8
commit c69dbe691e
5 changed files with 18 additions and 4 deletions

View File

@ -155,7 +155,12 @@ global $CFG;
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 File

@ -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 File

@ -139,7 +139,7 @@ global $CFG;
}
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 @@ global $CFG;
);");
}
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 File

@ -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 File

@ -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)