@@ 159-170 (lines=12) @@ | ||
156 | * @param AdapterInterface $executor The executor object for the plan |
|
157 | * @return void |
|
158 | */ |
|
159 | public function execute(AdapterInterface $executor) |
|
160 | { |
|
161 | foreach ($this->tableCreates as $newTable) { |
|
162 | $executor->createTable($newTable->getTable(), $newTable->getColumns(), $newTable->getIndexes()); |
|
163 | } |
|
164 | ||
165 | collection($this->updatesSequence()) |
|
166 | ->unfold() |
|
167 | ->each(function ($updates) use ($executor) { |
|
168 | $executor->executeActions($updates->getTable(), $updates->getActions()); |
|
169 | }); |
|
170 | } |
|
171 | ||
172 | /** |
|
173 | * Executes the inverse plan (rollback the actions) with the given AdapterInterface:w |
|
@@ 178-189 (lines=12) @@ | ||
175 | * @param AdapterInterface $executor The executor object for the plan |
|
176 | * @return void |
|
177 | */ |
|
178 | public function executeInverse(AdapterInterface $executor) |
|
179 | { |
|
180 | collection($this->inverseUpdatesSequence()) |
|
181 | ->unfold() |
|
182 | ->each(function ($updates) use ($executor) { |
|
183 | $executor->executeActions($updates->getTable(), $updates->getActions()); |
|
184 | }); |
|
185 | ||
186 | foreach ($this->tableCreates as $newTable) { |
|
187 | $executor->createTable($newTable->getTable(), $newTable->getColumns(), $newTable->getIndexes()); |
|
188 | } |
|
189 | } |
|
190 | ||
191 | /** |
|
192 | * Deletes certain actions from the plan if they are found to be conflicting or redundant. |