@@ 133-144 (lines=12) @@ | ||
130 | * @param AdapterInterface $executor The executor object for the plan |
|
131 | * @return void |
|
132 | */ |
|
133 | public function execute(AdapterInterface $executor) |
|
134 | { |
|
135 | foreach ($this->tableCreates as $newTable) { |
|
136 | $executor->createTable($newTable->getTable(), $newTable->getColumns(), $newTable->getIndexes()); |
|
137 | } |
|
138 | ||
139 | collection($this->updatesSequence()) |
|
140 | ->unfold() |
|
141 | ->each(function ($updates) use ($executor) { |
|
142 | $executor->executeActions($updates->getTable(), $updates->getActions()); |
|
143 | }); |
|
144 | } |
|
145 | ||
146 | /** |
|
147 | * Executes the inverse plan (rollback the actions) with the given AdapterInterface:w |
|
@@ 152-163 (lines=12) @@ | ||
149 | * @param AdapterInterface $executor The executor object for the plan |
|
150 | * @return void |
|
151 | */ |
|
152 | public function executeInverse(AdapterInterface $executor) |
|
153 | { |
|
154 | collection(array_reverse($this->updatesSequence())) |
|
155 | ->unfold() |
|
156 | ->each(function ($updates) use ($executor) { |
|
157 | $executor->executeActions($updates->getTable(), $updates->getActions()); |
|
158 | }); |
|
159 | ||
160 | foreach ($this->tableCreates as $newTable) { |
|
161 | $executor->createTable($newTable->getTable(), $newTable->getColumns(), $newTable->getIndexes()); |
|
162 | } |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * Deletes certain actions from the plan if they are found to be conflicting or redundant. |