];
}
}
- 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',
+ ];
}
}
}
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}
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}