From: Matthias Schmidt Date: Sat, 12 Dec 2020 14:08:25 +0000 (+0100) Subject: Merge branch '5.3' X-Git-Tag: 5.4.0_Alpha_1~550 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c8639be4c97dd4ab760aebd1413a6c36a59d7593;p=GitHub%2FWoltLab%2FWCF.git Merge branch '5.3' --- c8639be4c97dd4ab760aebd1413a6c36a59d7593 diff --cc wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php index 54436c8eca,fb83829dd2..f4f8b2c67b --- a/wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php @@@ -1128,55 -1081,57 +1137,64 @@@ class DatabaseTableChangeProcessor ]; } } - else if ($columnPackageID !== $this->package->packageID) { ++ else if ($column->getNewName()) { + $errors[] = [ + 'columnName' => $column->getName(), + 'tableName' => $table->getName(), - 'type' => 'foreignColumnChange' ++ 'type' => 'renameNonexistingColumn' + ]; + } } - else if ($column->getNewName()) { - $errors[] = [ - 'columnName' => $column->getName(), - 'tableName' => $table->getName(), - 'type' => 'renameNonexistingColumn' - ]; - } - } - - foreach ($table->getIndices() as $index) { - foreach ($existingIndices as $existingIndex) { - if (empty(array_diff($index->getData(), $existingIndex->getData()))) { - if ($index->willBeDropped()) { - if ($this->getIndexPackageID($table, $index) !== $this->package->packageID) { - $errors[] = [ - 'columnNames' => implode(',', $existingIndex->getColumns()), - 'tableName' => $table->getName(), - 'type' => 'foreignIndexDrop' - ]; + + foreach ($table->getIndices() as $index) { + foreach ($existingIndices as $existingIndex) { + if (empty(array_diff($index->getData(), $existingIndex->getData()))) { + if ($index->willBeDropped()) { + if ($this->getIndexPackageID($table, $index) !== $this->package->packageID) { + $errors[] = [ + 'columnNames' => implode(',', $existingIndex->getColumns()), + 'tableName' => $table->getName(), + 'type' => 'foreignIndexDrop', + ]; + } } + + continue 2; } - - continue 2; } } - } - - foreach ($table->getForeignKeys() as $foreignKey) { - foreach ($existingForeignKeys as $existingForeignKey) { - if (empty(array_diff($foreignKey->getData(), $existingForeignKey->getData()))) { - if ($foreignKey->willBeDropped()) { - if ($this->getForeignKeyPackageID($table, $foreignKey) !== $this->package->packageID) { - $errors[] = [ - 'columnNames' => implode(',', $existingForeignKey->getColumns()), - 'tableName' => $table->getName(), - 'type' => 'foreignForeignKeyDrop' - ]; + + foreach ($table->getForeignKeys() as $foreignKey) { + foreach ($existingForeignKeys as $existingForeignKey) { + if (empty(array_diff($foreignKey->getData(), $existingForeignKey->getData()))) { + if ($foreignKey->willBeDropped()) { + if ($this->getForeignKeyPackageID($table, $foreignKey) !== $this->package->packageID) { + $errors[] = [ + 'columnNames' => implode(',', $existingForeignKey->getColumns()), + 'tableName' => $table->getName(), + 'type' => 'foreignForeignKeyDrop', + ]; + } } + + continue 2; } - - continue 2; + } + } + } + } + + foreach ($table->getIndices() as $index) { + if ($index->getType() === DatabaseTableIndex::PRIMARY_TYPE && !$index->willBeDropped()) { + foreach ($index->getColumns() as $indexColumn) { + $column = $this->getColumnByName($indexColumn, $table, $existingTable); + if ($column !== null && !$column->isNotNull()) { + $errors[] = [ + 'columnName' => $indexColumn, + 'columnNames' => implode(',', $index->getColumns()), + 'tableName' => $table->getName(), + 'type' => 'nullColumnInPrimaryIndex', + ]; } } } diff --cc wcfsetup/install/lang/de.xml index 5dedd9206a,b44b0e263d..0d1557f8ef --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@@ -1962,10 -1970,10 +1961,12 @@@ Die Datenbestände werden sorgfältig g Die Spalte {$error[tableName]}.{$error[columnName]} gehört zu einem anderen Paket und kann deshalb nicht gelöscht werden. {else if $error[type] === 'foreignColumnChange'} Die Spalte {$error[tableName]}.{$error[columnName]} gehört zu einem anderen Paket und kann deshalb nicht gelöscht werden. + {else if $error[type] === 'renameNonexistingColumn'} + Die Spalte {$error[tableName]}.{$error[columnName]} existiert nicht und kann deshalb nicht umbenannt werden. {else if $error[type] === 'foreignIndexDrop'} Der Index {$error[tableName]} ({$error[columnNames]}) gehört zu einem anderen Paket und kann deshalb nicht gelöscht werden. + {else if $error[type] === 'nullColumnInPrimaryIndex'} + Der Primärindex {$error[tableName]} ({$error[columnNames]}) enthält die Spalte {$error[columnName]}, deren Werte NULL sein können. {else if $error[type] === 'foreignForeignKeyDrop'} Der Fremdschlüssel {$error[tableName]} ({$error[columnNames]}) gehört zu einem anderen Paket und kann deshalb nicht gelöscht werden. {else} diff --cc wcfsetup/install/lang/en.xml index 3711183481,cb11df0c22..18ae70978f --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@@ -1946,10 -1954,10 +1945,12 @@@ If you have already bought the The column {$error[tableName]}.{$error[columnName]} belongs to a different package and thus cannot be dropped. {else if $error[type] === 'foreignColumnChange'} The column {$error[tableName]}.{$error[columnName]} belongs to a different package and thus cannot be dropped. + {else if $error[type] === 'renameNonexistingColumn'} + The column {$error[tableName]}.{$error[columnName]} does not exist and thus cannot be renamed. {else if $error[type] === 'foreignIndexDrop'} The index {$error[tableName]} ({$error[columnNames]}) belongs to a different package and thus cannot be dropped. + {else if $error[type] === 'nullColumnInPrimaryIndex'} + The primary index {$error[tableName]} ({$error[columnNames]}) contains the column {$error[columnName]} whose values can be NULL. {else if $error[type] === 'foreignForeignKeyDrop'} The foreign key {$error[tableName]} ({$error[columnNames]}) belongs to a different package and thus cannot be dropped. {else}