1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 07:47:00 +02:00
This commit is contained in:
Ryan Cramer
2023-05-30 13:45:00 -04:00
parent 8046f1989b
commit f3a0b265ee

View File

@@ -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 {
}
}