![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/doctrine/migrations/lib/Doctrine/Migrations/ |
<?php declare(strict_types=1); namespace Doctrine\Migrations; use Doctrine\Migrations\Exception\RollupFailed; use Doctrine\Migrations\Metadata\Storage\MetadataStorage; use Doctrine\Migrations\Version\ExecutionResult; use Doctrine\Migrations\Version\Version; use function count; /** * The Rollup class is responsible for deleting all previously executed migrations from the versions table * and marking the freshly dumped schema migration (that was created with SchemaDumper) as migrated. * * @internal */ class Rollup { private MigrationsRepository $migrationRepository; private MetadataStorage $metadataStorage; public function __construct( MetadataStorage $metadataStorage, MigrationsRepository $migrationRepository ) { $this->migrationRepository = $migrationRepository; $this->metadataStorage = $metadataStorage; } /** * @throws RollupFailed */ public function rollup(): Version { $versions = $this->migrationRepository->getMigrations(); if (count($versions) === 0) { throw RollupFailed::noMigrationsFound(); } if (count($versions) > 1) { throw RollupFailed::tooManyMigrations(); } $this->metadataStorage->reset(); $result = new ExecutionResult($versions->getItems()[0]->getVersion()); $this->metadataStorage->complete($result); return $result->getVersion(); } }