Unverified Commit 9f843bca authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2942 from carusogabriel/combine-consecutives-unsets

Combine consecutives unsets
parents c8e6c9c3 9e7c1dc2
...@@ -288,8 +288,7 @@ class MasterSlaveConnection extends Connection ...@@ -288,8 +288,7 @@ class MasterSlaveConnection extends Connection
*/ */
public function close() public function close()
{ {
unset($this->connections['master']); unset($this->connections['master'], $this->connections['slave']);
unset($this->connections['slave']);
parent::close(); parent::close();
......
...@@ -698,8 +698,7 @@ class DB2Platform extends AbstractPlatform ...@@ -698,8 +698,7 @@ class DB2Platform extends AbstractPlatform
$sql[] = $this->getCreateIndexSQL($addIndex, $table); $sql[] = $this->getCreateIndexSQL($addIndex, $table);
unset($diff->removedIndexes[$remKey]); unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]);
unset($diff->addedIndexes[$addKey]);
break; break;
} }
......
...@@ -660,8 +660,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -660,8 +660,7 @@ class MySqlPlatform extends AbstractPlatform
$sql[] = $query; $sql[] = $query;
unset($diff->removedIndexes[$remKey]); unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]);
unset($diff->addedIndexes[$addKey]);
break; break;
} }
......
...@@ -818,9 +818,11 @@ class SqlitePlatform extends AbstractPlatform ...@@ -818,9 +818,11 @@ class SqlitePlatform extends AbstractPlatform
$columnName = strtolower($columnName); $columnName = strtolower($columnName);
if (isset($columns[$columnName])) { if (isset($columns[$columnName])) {
unset($columns[$columnName]); unset(
unset($oldColumnNames[$columnName]); $columns[$columnName],
unset($newColumnNames[$columnName]); $oldColumnNames[$columnName],
$newColumnNames[$columnName]
);
} }
} }
......
...@@ -279,14 +279,12 @@ class Comparator ...@@ -279,14 +279,12 @@ class Comparator
foreach ($fromFkeys as $key1 => $constraint1) { foreach ($fromFkeys as $key1 => $constraint1) {
foreach ($toFkeys as $key2 => $constraint2) { foreach ($toFkeys as $key2 => $constraint2) {
if ($this->diffForeignKey($constraint1, $constraint2) === false) { if ($this->diffForeignKey($constraint1, $constraint2) === false) {
unset($fromFkeys[$key1]); unset($fromFkeys[$key1], $toFkeys[$key2]);
unset($toFkeys[$key2]);
} else { } else {
if (strtolower($constraint1->getName()) == strtolower($constraint2->getName())) { if (strtolower($constraint1->getName()) == strtolower($constraint2->getName())) {
$tableDifferences->changedForeignKeys[] = $constraint2; $tableDifferences->changedForeignKeys[] = $constraint2;
$changes++; $changes++;
unset($fromFkeys[$key1]); unset($fromFkeys[$key1], $toFkeys[$key2]);
unset($toFkeys[$key2]);
} }
} }
} }
...@@ -332,8 +330,10 @@ class Comparator ...@@ -332,8 +330,10 @@ class Comparator
if ( ! isset($tableDifferences->renamedColumns[$removedColumnName])) { if ( ! isset($tableDifferences->renamedColumns[$removedColumnName])) {
$tableDifferences->renamedColumns[$removedColumnName] = $addedColumn; $tableDifferences->renamedColumns[$removedColumnName] = $addedColumn;
unset($tableDifferences->addedColumns[$addedColumnName]); unset(
unset($tableDifferences->removedColumns[$removedColumnName]); $tableDifferences->addedColumns[$addedColumnName],
$tableDifferences->removedColumns[$removedColumnName]
);
} }
} }
} }
...@@ -373,8 +373,10 @@ class Comparator ...@@ -373,8 +373,10 @@ class Comparator
if (! isset($tableDifferences->renamedIndexes[$removedIndexName])) { if (! isset($tableDifferences->renamedIndexes[$removedIndexName])) {
$tableDifferences->renamedIndexes[$removedIndexName] = $addedIndex; $tableDifferences->renamedIndexes[$removedIndexName] = $addedIndex;
unset($tableDifferences->addedIndexes[$addedIndexName]); unset(
unset($tableDifferences->removedIndexes[$removedIndexName]); $tableDifferences->addedIndexes[$addedIndexName],
$tableDifferences->removedIndexes[$removedIndexName]
);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment