Add PartialDatabaseTable
authorMatthias Schmidt <gravatronics@live.com>
Sun, 29 Sep 2019 17:16:22 +0000 (19:16 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 29 Sep 2019 17:16:22 +0000 (19:16 +0200)
Close #3081

wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php
wcfsetup/install/files/lib/system/database/table/PartialDatabaseTable.class.php [new file with mode: 0644]

index 3672aba3c4d7c2fd386a45b5d2ddda4daf18a38e..6a0edd586f531f518e5a7bfe1b15633d17416bc3 100644 (file)
@@ -373,6 +373,10 @@ class DatabaseTableChangeProcessor {
                                }
                        }
                        else if (!in_array($tableName, $this->existingTableNames)) {
+                               if ($table instanceof PartialDatabaseTable) {
+                                       throw new \LogicException("Partial table '{$tableName}' cannot be created.");
+                               }
+                               
                                $this->tablesToCreate[] = $table;
                                
                                $this->splitNodeMessage .= "Created table '{$tableName}'.";
diff --git a/wcfsetup/install/files/lib/system/database/table/PartialDatabaseTable.class.php b/wcfsetup/install/files/lib/system/database/table/PartialDatabaseTable.class.php
new file mode 100644 (file)
index 0000000..3430d18
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+namespace wcf\system\database\table;
+
+/**
+ * PHP representation of layout changes to an existing database table.
+ * 
+ * Trying to create a table represented by this class causes an exception.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2019 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Database\Table
+ * @since      5.2
+ */
+class PartialDatabaseTable extends DatabaseTable {}