Skip to content

Commit

Permalink
Fixed issue with the diff command when new tables are also included i…
Browse files Browse the repository at this point in the history
…n the changed tables list.
  • Loading branch information
Carlos Cima committed Apr 11, 2016
1 parent 7924dca commit ab8e44e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Differ.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ private function diffColumns(ChangedTable $changedTable)
*/
private function addChangedColumn(ChangedTable $changedTable, Column $column)
{
$changedTable->addChangedColumn($column);
if (!$changedTable->hasNewColumn($column->getName())) {
$changedTable->addChangedColumn($column);
}

if (!$column->getNextColumn()) {
return;
Expand Down
14 changes: 14 additions & 0 deletions src/Model/ChangedTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,20 @@ public function getNewColumns()
public function addNewColumn(Column $newColumn)
{
$this->newColumns[$newColumn->getName()] = $newColumn;

if (isset($this->changedColumns[$newColumn->getName()])) {
unset($this->changedColumns[$newColumn->getName()]);
}
}

/**
* @param $columnName
*
* @return bool
*/
public function hasNewColumn($columnName)
{
return isset($this->newColumns[$columnName]);
}

/**
Expand Down

0 comments on commit ab8e44e

Please sign in to comment.