make sure all tables are innodb, for foreign keys to work
This commit is contained in:
parent
c9c4843e43
commit
c9283ef010
@ -57,6 +57,10 @@ class AdminPage implements Extension {
|
||||
$this->purge_unused_tags();
|
||||
$redirect = true;
|
||||
break;
|
||||
case 'convert to innodb':
|
||||
$this->convert_to_innodb();
|
||||
$redirect = true;
|
||||
break;
|
||||
case 'database dump':
|
||||
$this->dbdump($page);
|
||||
break;
|
||||
@ -142,6 +146,17 @@ class AdminPage implements Extension {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function convert_to_innodb() {
|
||||
global $database;
|
||||
if($database->engine->name == "mysql") {
|
||||
$tables = $database->db->MetaTables();
|
||||
foreach($tables as $table) {
|
||||
log_info("upgrade", "converting $table to innodb");
|
||||
$database->execute("ALTER TABLE $table TYPE=INNODB");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add_event_listener(new AdminPage());
|
||||
?>
|
||||
|
@ -40,6 +40,7 @@ class AdminPageTheme extends Themelet {
|
||||
<option value='recount tag use'>Recount tag use</option>
|
||||
<option value='purge unused tags'>Purge unused tags</option>
|
||||
<option value='database dump'>Download database contents</option>
|
||||
<option value='convert to innodb'>Convert database to InnoDB (MySQL only)</option>
|
||||
</select>
|
||||
<input type='submit' value='Go'>
|
||||
</form>
|
||||
|
@ -18,9 +18,20 @@ class Upgrade implements Extension {
|
||||
// cry :S
|
||||
}
|
||||
|
||||
if($config->get_int("db_version") < 6) { // 7
|
||||
// add column image->locked
|
||||
if($config->get_int("db_version") < 7) {
|
||||
if($database->engine->name == "mysql") {
|
||||
$tables = $database->db->MetaTables();
|
||||
foreach($tables as $table) {
|
||||
log_info("upgrade", "converting $table to innodb");
|
||||
$database->execute("ALTER TABLE $table TYPE=INNODB");
|
||||
}
|
||||
}
|
||||
$config->set_int("db_version", 7);
|
||||
log_info("Database at version 7");
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// add column image->locked
|
||||
}
|
||||
}
|
||||
add_event_listener(new Upgrade(), 5);
|
||||
|
Loading…
x
Reference in New Issue
Block a user