| Conditions | 3 |
| Paths | 3 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 4 | public function rollup() : Version |
|
| 36 | { |
||
| 37 | 4 | $versions = $this->migrationRepository->getVersions(); |
|
| 38 | |||
| 39 | 4 | if (count($versions) === 0) { |
|
| 40 | 1 | throw new RuntimeException('No migrations found.'); |
|
| 41 | } |
||
| 42 | |||
| 43 | 3 | if (count($versions) > 1) { |
|
| 44 | 1 | throw new RuntimeException('Too many migrations.'); |
|
| 45 | } |
||
| 46 | |||
| 47 | 2 | $sql = sprintf( |
|
| 48 | 2 | 'DELETE FROM %s', |
|
| 49 | 2 | $this->configuration->getMigrationsTableName() |
|
| 50 | ); |
||
| 51 | |||
| 52 | 2 | $this->connection->executeQuery($sql); |
|
| 53 | |||
| 54 | 2 | $version = current($versions); |
|
| 55 | |||
| 56 | 2 | $version->markMigrated(); |
|
| 57 | |||
| 58 | 2 | return $version; |
|
| 59 | } |
||
| 61 |