| Conditions | 7 |
| Paths | 11 |
| Total Lines | 32 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 23 | public function run(Registry $registry): Registry |
||
| 24 | { |
||
| 25 | foreach ($registry as $entity) { |
||
| 26 | if (!$registry->hasTable($entity)) { |
||
| 27 | continue; |
||
| 28 | } |
||
| 29 | |||
| 30 | $schema = $registry->getTableSchema($entity); |
||
| 31 | if ($schema->exists()) { |
||
| 32 | $state = $schema->getState(); |
||
| 33 | |||
| 34 | // clean up all indexes and columns |
||
| 35 | foreach ($state->getForeignKeys() as $fk) { |
||
| 36 | $state->forgerForeignKey($fk); |
||
| 37 | } |
||
| 38 | |||
| 39 | // clean up all indexes and columns |
||
| 40 | foreach ($state->getColumns() as $column) { |
||
| 41 | $state->forgetColumn($column); |
||
| 42 | } |
||
| 43 | |||
| 44 | foreach ($state->getIndexes() as $index) { |
||
| 45 | $state->forgetIndex($index); |
||
| 46 | } |
||
| 47 | |||
| 48 | $state->setPrimaryKeys([]); |
||
| 49 | |||
| 50 | $schema->setState($state); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | return $registry; |
||
| 55 | } |
||
| 56 | } |