src/Phinx/Db/Plan/Plan.php
protected function forgetDropIndex(Table $table, array $columns, array $actions)
    {
        $dropIndexActions = new ArrayObject();
        $indexes = collection($actions)
            ->map(function ($alter) use ($table, $columns, $dropIndexActions) {
                if ($alter->getTable()->getName() !== $table->getName()) {
                    return $alter;
                }

                $newAlter = new AlterTable($table);
                collection($alter->getActions())
                    ->map(function ($action) use ($columns) {
                        if (!$action instanceof DropIndex) {
                            return [$action, null];
                        }
                        if ($action->getIndex()->getColumns() === $columns) {
                            return [null, $action];
                        }

                        return [$action, null];
                    })
                    ->each(function ($tuple) use ($newAlter, $dropIndexActions) {
                        list($action, $dropIndex) = $tuple;
                        if ($action) {
                            $newAlter->addAction($action);
                        }
                        if ($dropIndex) {
                            $dropIndexActions->append($dropIndex);
                        }
                    });

                return $newAlter;
            })
            ->toArray();

        return [$indexes, $dropIndexActions->getArrayCopy()];
    }
protected function forgetDropIndex(Table $table, array $columns, array $actions)
    {
        $dropIndexActions = new ArrayObject();
        $indexes = collection($actions)
            ->map(function ($alter) use ($table, $columns, $dropIndexActions) {
                if ($alter->getTable()->getName() !== $table->getName()) {
                    return $alter;
                }

                $newAlter = new AlterTable($table);
                collection($alter->getActions())
                    ->map(function ($action) use ($columns) {
                        if (!$action instanceof DropIndex) {
                            return [$action, null];
                        }
                        if ($action->getIndex()->getColumns() === $columns) {
                            return [null, $action];
                        }

                        return [$action, null];
                    })
                    ->each(function ($tuple) use ($newAlter, $dropIndexActions) {
                        list($action, $dropIndex) = $tuple;
                        if ($action) {
                            $newAlter->addAction($action);
                        }
                        if ($dropIndex) {
                            $dropIndexActions->append($dropIndex);
                        }
                    });

                return $newAlter;
            })
            ->toArray();

        return [$indexes, $dropIndexActions->getArrayCopy()];
    }
protected function forgetDropIndex ( Table $ table , array $ columns , array $ actions ) { $ dropIndexActions = new ArrayObject ( ) ; $ indexes = collection ( $ actions ) -> map ( function ( $ alter ) use ( $ table , $ columns , $ dropIndexActions ) { if ( $ alter -> getTable ( ) -> getName ( ) !== $ table -> getName ( ) ) { return $ alter ; } $ newAlter = new AlterTable ( $ table ) ; collection ( $ alter -> getActions ( ) ) -> map ( function ( $ action ) use ( $ columns ) { if ( ! $ action instanceof DropIndex ) { return [ $ action , null ] ; } if ( $ action -> getIndex ( ) -> getColumns ( ) === $ columns ) { return [ null , $ action ] ; } return [ $ action , null ] ; } ) -> each ( function ( $ tuple ) use ( $ newAlter , $ dropIndexActions ) { list ( $ action , $ dropIndex ) = $ tuple ; if ( $ action ) { $ newAlter -> addAction ( $ action ) ; } if ( $ dropIndex ) { $ dropIndexActions -> append ( $ dropIndex ) ; } } ) ; return $ newAlter ; } ) -> toArray ( ) ; return [ $ indexes , $ dropIndexActions -> getArrayCopy ( ) ] ; }
Deletes any DropIndex actions for the given table and exact columns

@param Table $table The table to find in the list of actions
@param string[] $columns The column names to match
@param AlterTable[] $actions The actions to transform
@return array A tuple containing the list of actions without actions for dropping the index
and a list of drop index actions that were removed.
Deletes any DropIndex actions for the given table and exact columns