Commit 64be2d74 authored by Till Brehm's avatar Till Brehm

Implemented #5209 Add support for renaming empty databases

parent 38751c07
......@@ -331,6 +331,7 @@ class mysql_clientdb_plugin {
$timestamp = time();
$tables = $link->query("SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema='".$old_name."' AND TABLE_TYPE='BASE TABLE'");
$tables_all = $link->query("SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema='".$old_name."'");
if ($tables->num_rows > 0) {
while ($row = $tables->fetch_assoc()) {
$tables_array[] = $row['TABLE_NAME'];
......@@ -436,6 +437,11 @@ class mysql_clientdb_plugin {
}
}
} elseif ($tables->num_rows == 0 && $tables_all->num_rows == 0) {
//* Rename empty database by creating a new one and dropping the old database
$this->db_insert($event_name, $data);
$this->db_delete($event_name, $data);
} else { //* SELECT TABLE_NAME error
$app->log('Unable to rename database '.$old_name.' to '.$new_name, LOGLEVEL_ERROR);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment