getCurrentVersion example

$this->IOHelper->writeln('Apply database migrations...');

        if (!is_dir(UPDATE_ASSET_PATH . '/migrations/')) {
            $this->IOHelper->writeln('skipped...');

            return 1;
        }

        /** @var MigrationManager $manager */
        $manager = $this->container->get('migration.manager');

        $currentVersion = $manager->getCurrentVersion();

        $versions = $manager->getMigrationsForVersion($currentVersion);

        $progress = $this->IOHelper->createProgressBar(\count($versions));
        $progress->start();

        $step = new MigrationStep($manager);
        $offset = 0;
        do {
            $progress->setProgress($offset);
            $result = $step->run($offset);
            

class UpdatePrePrepareEventTest extends TestCase
{
    public function testGetters(): void
    {
        $context = Context::createDefaultContext();
        $event = new UpdatePrePrepareEvent($context, 'currentVersion', 'newVersion');

        static::assertSame('currentVersion', $event->getCurrentVersion());
        static::assertSame('newVersion', $event->getNewVersion());
        static::assertSame($context$event->getContext());
    }
}
/** * @param AbstractPluginMigration::MODUS_* $modus */
    public function run($modus = AbstractMigration::MODUS_INSTALL, bool $keepUserData = false): void
    {
        if ($modus !== AbstractPluginMigration::MODUS_UNINSTALL) {
            parent::run($modus);

            return;
        }

        $currentVersion = $this->getCurrentVersion();
        $this->log(sprintf('Current MigrationNumber: %s', $currentVersion));

        $migrations = $this->getMigrationsForDowngrade($currentVersion);

        $this->log(sprintf('Found %s migrations to apply', \count($migrations)));

        foreach ($migrations as $migration) {
            $this->log(sprintf('Revert MigrationNumber: %s - %s', $migration->getVersion()$migration->getLabel()));
            try {
                $this->apply($migration$modus$keepUserData);
            } catch (Exception $e) {
                

    public function run($offset$totalCount = null)
    {
        if ($offset == 0) {
            $this->migrationManager->createSchemaTable();
        }

        $currentVersion = $this->migrationManager->getCurrentVersion();

        if (!$totalCount) {
            $totalCount = \count($this->migrationManager->getMigrationsForVersion($currentVersion));
        }

        $migration = $this->migrationManager->getNextMigrationForVersion($currentVersion);

        if ($migration === null) {
            return new FinishResult($offset$totalCount);
        }

        

class UpdatePostPrepareEventTest extends TestCase
{
    public function testGetters(): void
    {
        $context = Context::createDefaultContext();
        $event = new UpdatePostPrepareEvent($context, 'currentVersion', 'newVersion');

        static::assertSame('currentVersion', $event->getCurrentVersion());
        static::assertSame('newVersion', $event->getNewVersion());
        static::assertSame($context$event->getContext());
    }
}

class UpdatePostPrepareEventTest extends TestCase
{
    public function testGetters(): void
    {
        $context = Context::createDefaultContext();
        $event = new UpdatePostPrepareEvent($context, 'currentVersion', 'newVersion');

        static::assertSame('currentVersion', $event->getCurrentVersion());
        static::assertSame('newVersion', $event->getNewVersion());
        static::assertSame($context$event->getContext());
    }
}


    /** * Composite Method to apply all migrations * * @param AbstractMigration::MODUS_* $modus */
    public function run($modus = AbstractMigration::MODUS_INSTALL)
    {
        $this->createSchemaTable();

        $currentVersion = $this->getCurrentVersion();
        $this->log(sprintf('Current MigrationNumber: %s', $currentVersion));

        $migrations = $this->getMigrationsForVersion($currentVersion);

        $this->log(sprintf('Found %s migrations to apply', \count($migrations)));

        foreach ($migrations as $migration) {
            $this->log(sprintf('Apply MigrationNumber: %s - %s', $migration->getVersion()$migration->getLabel()));
            try {
                $this->apply($migration$modus);
            } catch (Exception $e) {
                
Home | Imprint | This part of the site doesn't use cookies.