bug #2852370 [operations] Renaming database deletes triggers
This commit is contained in:
@@ -97,6 +97,11 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
}
|
||||
|
||||
if ($this_what != 'nocopy') {
|
||||
// keep the triggers from the original db+table
|
||||
// (third param is empty because delimiters are only intended
|
||||
// for importing via the mysql client or our Import feature)
|
||||
$triggers = PMA_DBI_get_triggers($db, $each_table, '');
|
||||
|
||||
if (! PMA_Table::moveCopy($db, $each_table, $newname, $each_table,
|
||||
isset($this_what) ? $this_what : 'data', $move, 'db_copy'))
|
||||
{
|
||||
@@ -105,6 +110,16 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
$sql_query = $back . $sql_query;
|
||||
break;
|
||||
}
|
||||
// apply the triggers to the destination db+table
|
||||
if ($triggers) {
|
||||
PMA_DBI_select_db($newname);
|
||||
foreach ($triggers as $trigger) {
|
||||
PMA_DBI_query($trigger['create']);
|
||||
}
|
||||
unset($trigger);
|
||||
}
|
||||
unset($triggers);
|
||||
|
||||
if (isset($GLOBALS['add_constraints'])) {
|
||||
$GLOBALS['sql_constraints_query_full_db'] .= $GLOBALS['sql_constraints_query'];
|
||||
unset($GLOBALS['sql_constraints_query']);
|
||||
|
Reference in New Issue
Block a user