src/Phinx/Db/Plan/Plan.php
protected function resolveConflicts()
    {
        $moveActions = collection($this->tableMoves)
            ->unfold(function ($move) {
                return $move->getActions();
            });

        foreach ($moveActions as $action) {
            if ($action instanceof DropTable) {
                $this->tableUpdates = $this->forgetTable($action->getTable(), $this->tableUpdates);
                $this->constraints = $this->forgetTable($action->getTable(), $this->constraints);
                $this->indexes = $this->forgetTable($action->getTable(), $this->indexes);
            }
        }

        $this->tableUpdates = collection($this->tableUpdates)
            // Renaming a column and then changing the renamed column is something people do,
            // but it is a conflicting action. Luckily solving the conflict can be done by moving
            // the ChangeColumn action to another AlterTable
            ->unfold(new ActionSplitter(RenameColumn::class, ChangeColumn::class, function (RenameColumn $a, ChangeColumn $b) {
                return $a->getNewName() == $b->getColumnName();
            }))
            ->toList();

        $this->constraints = collection($this->constraints)
            ->map(function (AlterTable $alter) {
                // Dropping indexes used by foreign keys is a conflict, but one we can resolve
                // if the foreign key is also scheduled to be dropped. If we can find sucha a case,
                // we force the execution of the index drop after the foreign key is dropped.
                return $this->remapContraintAndIndexConflicts($alter);
            })
            // Changing constraint properties sometimes require dropping it and then
            // creating it again with the new stuff. Unfortunately, we have already bundled
            // everything together in as few AlterTable statements as we could, so we need to
            // resolve this conflict manually
            ->unfold(new ActionSplitter(DropForeignKey::class, AddForeignKey::class, function (DropForeignKey $a, AddForeignKey $b) {
                return $a->getForeignKey()->getColumns() === $b->getForeignKey()->getColumns();
            }))
            ->toList();
    }
protected function resolveConflicts()
    {
        $moveActions = collection($this->tableMoves)
            ->unfold(function ($move) {
                return $move->getActions();
            });

        foreach ($moveActions as $action) {
            if ($action instanceof DropTable) {
                $this->tableUpdates = $this->forgetTable($action->getTable(), $this->tableUpdates);
                $this->constraints = $this->forgetTable($action->getTable(), $this->constraints);
                $this->indexes = $this->forgetTable($action->getTable(), $this->indexes);
            }
        }

        $this->tableUpdates = collection($this->tableUpdates)
            // Renaming a column and then changing the renamed column is something people do,
            // but it is a conflicting action. Luckily solving the conflict can be done by moving
            // the ChangeColumn action to another AlterTable
            ->unfold(new ActionSplitter(RenameColumn::class, ChangeColumn::class, function (RenameColumn $a, ChangeColumn $b) {
                return $a->getNewName() == $b->getColumnName();
            }))
            ->toList();

        $this->constraints = collection($this->constraints)
            ->map(function (AlterTable $alter) {
                // Dropping indexes used by foreign keys is a conflict, but one we can resolve
                // if the foreign key is also scheduled to be dropped. If we can find sucha a case,
                // we force the execution of the index drop after the foreign key is dropped.
                return $this->remapContraintAndIndexConflicts($alter);
            })
            // Changing constraint properties sometimes require dropping it and then
            // creating it again with the new stuff. Unfortunately, we have already bundled
            // everything together in as few AlterTable statements as we could, so we need to
            // resolve this conflict manually
            ->unfold(new ActionSplitter(DropForeignKey::class, AddForeignKey::class, function (DropForeignKey $a, AddForeignKey $b) {
                return $a->getForeignKey()->getColumns() === $b->getForeignKey()->getColumns();
            }))
            ->toList();
    }
protected function resolveConflicts ( ) { $ moveActions = collection ( $ this -> tableMoves ) -> unfold ( function ( $ move ) { return $ move -> getActions ( ) ; } ) ; foreach ( $ moveActions as $ action ) { if ( $ action instanceof DropTable ) { $ this -> tableUpdates = $ this -> forgetTable ( $ action -> getTable ( ) , $ this -> tableUpdates ) ; $ this -> constraints = $ this -> forgetTable ( $ action -> getTable ( ) , $ this -> constraints ) ; $ this -> indexes = $ this -> forgetTable ( $ action -> getTable ( ) , $ this -> indexes ) ; } } $ this -> tableUpdates = collection ( $ this -> tableUpdates ) // Renaming a column and then changing the renamed column is something people do, // but it is a conflicting action. Luckily solving the conflict can be done by moving // the ChangeColumn action to another AlterTable -> unfold ( new ActionSplitter ( RenameColumn :: class , ChangeColumn :: class , function ( RenameColumn $ a , ChangeColumn $ b ) { return $ a -> getNewName ( ) == $ b -> getColumnName ( ) ; } ) ) -> toList ( ) ; $ this -> constraints = collection ( $ this -> constraints ) -> map ( function ( AlterTable $ alter ) { // Dropping indexes used by foreign keys is a conflict, but one we can resolve // if the foreign key is also scheduled to be dropped. If we can find sucha a case, // we force the execution of the index drop after the foreign key is dropped. return $ this -> remapContraintAndIndexConflicts ( $ alter ) ; } ) // Changing constraint properties sometimes require dropping it and then // creating it again with the new stuff. Unfortunately, we have already bundled // everything together in as few AlterTable statements as we could, so we need to // resolve this conflict manually -> unfold ( new ActionSplitter ( DropForeignKey :: class , AddForeignKey :: class , function ( DropForeignKey $ a , AddForeignKey $ b ) { return $ a -> getForeignKey ( ) -> getColumns ( ) === $ b -> getForeignKey ( ) -> getColumns ( ) ; } ) ) -> toList ( ) ; }
Deletes certain actions from the plan if they are found to be conflicting or redundant.

@return void
Deletes certain actions from the plan if they are found to be conflicting or redundant .