getMigrationsForDowngrade example

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) {
                $this->log($e->getMessage());
                throw $e;
            }
        }
Home | Imprint | This part of the site doesn't use cookies.