Conditions | 7 |
Paths | 11 |
Total Lines | 30 |
Code Lines | 14 |
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 | $schema->setState($state); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | return $registry; |
||
53 | } |
||
54 | } |