mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 07:47:00 +02:00
Fix issue processwire/processwire-issues#1741
This commit is contained in:
@@ -337,6 +337,10 @@ class Fields extends WireSaveableItems {
|
||||
// even if only the case has changed.
|
||||
$schema = $item->type->getDatabaseSchema($item);
|
||||
if(!empty($schema)) {
|
||||
foreach(array($table, "tmp_$table") as $t) {
|
||||
if(!$database->tableExists($t)) continue;
|
||||
throw new WireException("Cannot rename to '$item->name' because table `$table` already exists");
|
||||
}
|
||||
$database->exec("RENAME TABLE `$prevTable` TO `tmp_$table`"); // QA
|
||||
$database->exec("RENAME TABLE `tmp_$table` TO `$table`"); // QA
|
||||
}
|
||||
@@ -1488,4 +1492,3 @@ class Fields extends WireSaveableItems {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user