collectAllForVersion example

private readonly string $version
    ) {
    }

    /** * @return array{offset: int, total: int, isFinished: bool} */
    public function migrate(int $offset, Connection $connection): array
    {
        $migrationLoader = $this->migrationFactory->getMigrationCollectionLoader($connection);

        $coreMigrations = $migrationLoader->collectAllForVersion($this->version);

        if ($offset === 0) {
            $this->adapter->initializeShopwareDb($connection);

            $coreMigrations->sync();
        }

        // use 7 s as max execution time, so the UI stays responsive         $maxExecutionTime = min(\ini_get('max_execution_time'), 7);
        $startTime = microtime(true);
        $executedMigrations = $offset;

        


    private function isBasicDataMigration(string $className): bool
    {
        return $className === Migration1536233560BasicData::class;
    }

    private function collectMigrations(): MigrationCollection
    {
        return $this->getContainer()
            ->get(MigrationCollectionLoader::class)
            ->collectAllForVersion(
                $this->getContainer()->getParameter('kernel.shopware_version'),
                MigrationCollectionLoader::VERSION_SELECTION_ALL
            );
    }

    private function setupDB(Connection $orgConnection): Connection
    {
        // Be sure that we are on the no migrations db         static::assertStringContainsString('_no_migrations', $this->databaseName, 'Wrong DB ' . $this->databaseName);

        $orgConnection->executeStatement('DROP DATABASE IF EXISTS `' . $this->databaseName . '`');

        
return \count($collection->getExecutableDestructiveMigrations($until$limit));
    }

    protected function collectMigrations(InputInterface $input, string $identifier): MigrationCollection
    {
        if ($identifier === 'core') {
            $mode = $input->getOption('version-selection-mode');
            if (!\is_string($mode)) {
                throw new \InvalidArgumentException('version-selection-mode should be a string');
            }

            return $this->loader->collectAllForVersion($this->shopwareVersion, $mode);
        }

        return $this->loader->collect($identifier);
    }
}
if ($total > 0) {
            $this->cache->clear();
            $this->io->writeln('cleared the shopware cache');
        }

        return self::SUCCESS;
    }

    protected function collectMigrations(InputInterface $input, string $identifier): MigrationCollection
    {
        if ($identifier === 'core') {
            return $this->loader->collectAllForVersion(
                $this->shopwareVersion,
                MigrationCollectionLoader::VERSION_SELECTION_ALL
            );
        }

        return $this->loader->collect($identifier);
    }

    private function finishProgress(int $migrated, int $total): void
    {
        if ($migrated === $total) {
            
Home | Imprint | This part of the site doesn't use cookies.