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