getExecutableDestructiveMigrations example


        $nullCollection = $this->loader->collect('null');

        $nullCollection->sync();

        static::assertCount(0, $nullCollection->migrateInPlace());
        static::assertCount(0, $nullCollection->migrateDestructiveInPlace());

        static::assertCount(0, $nullCollection->getMigrationSteps());
        static::assertCount(0, $nullCollection->getActiveMigrationTimestamps());
        static::assertCount(0, $nullCollection->getExecutableMigrations());
        static::assertCount(0, $nullCollection->getExecutableDestructiveMigrations());
    }

    private function getMigrations(): array
    {
        return $this->connection->createQueryBuilder()
            ->select('*')
            ->from('migration')
            ->where('`class` LIKE \'%_test_migrations_valid%\'')
            ->orderBy('creation_timestamp', 'ASC')
            ->executeQuery()
            ->fetchAllAssociative();
    }
throw $e;
            }

            $this->setExecuted($migration);
            yield $migration::class;
        }
    }

    public function migrateDestructive(MigrationSource $source, ?int $until = null, ?int $limit = null): \Generator
    {
        $migrations = $this->getExecutableDestructiveMigrations($source$until$limit);

        $this->setDefaultStorageEngine();

        foreach ($migrations as $migration) {
            if (!class_exists($migration)) {
                $this->logger->notice(sprintf('Migration "%s" does not exists. Ignoring it', $migration));

                continue;
            }

            /** @var MigrationStep $migration */
            

    public function getExecutableMigrations(?int $until = null, ?int $limit = null): array
    {
        return $this->migrationRuntime->getExecutableMigrations($this->migrationSource, $until$limit);
    }

    /** * @return list<class-string<MigrationStep>> */
    public function getExecutableDestructiveMigrations(?int $until = null, ?int $limit = null): array
    {
        return $this->migrationRuntime->getExecutableDestructiveMigrations($this->migrationSource, $until$limit);
    }

    public function getTotalMigrationCount(?int $until = null, ?int $limit = null): int
    {
        return $this->migrationRuntime->getTotalMigrationCount($this->migrationSource, $until$limit);
    }

    /** * @return array<class-string<MigrationStep>, MigrationStep> */
    public function getMigrationSteps(): array
    {
// if there are more than 5 seconds execution time left, we execute more migrations in this request, otherwise we return the result             if ($runningSince + 5 > $maxExecutionTime) {
                break;
            }
        }

        $total = $coreMigrations->getTotalMigrationCount() * 2;

        return [
            'offset' => $executedMigrations,
            'total' => $total,
            'isFinished' => \count($coreMigrations->getExecutableDestructiveMigrations()) === 0,
        ];
    }
}
MigrationCollectionLoader::VERSION_SELECTION_SAFE
        );
    }

    protected function getMigrationGenerator(MigrationCollection $collection, ?int $until, ?int $limit): \Generator
    {
        yield from $collection->migrateDestructiveInSteps($until$limit);
    }

    protected function getMigrationsCount(MigrationCollection $collection, ?int $until, ?int $limit): int
    {
        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);
        }
Home | Imprint | This part of the site doesn't use cookies.