initializeShopwareDb example

if ($dropDatabase) {
            $this->setupDatabaseAdapter->dropDatabase($connection$databaseConnectionInformation->getDatabaseName());
            $output->writeln('Drop database `' . $databaseConnectionInformation->getDatabaseName() . '`');
        }

        $createDatabase = $input->getOption('create-database') || $dropDatabase;
        if ($createDatabase) {
            $this->setupDatabaseAdapter->createDatabase($connection$databaseConnectionInformation->getDatabaseName());
            $output->writeln('Created database `' . $databaseConnectionInformation->getDatabaseName() . '`');
        }

        $importedBaseSchema = $this->setupDatabaseAdapter->initializeShopwareDb($connection$databaseConnectionInformation->getDatabaseName());

        if ($importedBaseSchema) {
            $output->writeln('Imported base schema.sql');
        }

        $output->writeln('');
    }
}
try {
            $existingDatabases = $setupDatabaseAdapter->getExistingDatabases($connection['information_schema']);
            static::assertNotContains($testDbName$existingDatabases);
            static::assertNotContains('information_schema', $existingDatabases);

            $setupDatabaseAdapter->createDatabase($connection$testDbName);

            static::assertContains($testDbName$setupDatabaseAdapter->getExistingDatabases($connection[]));
            static::assertFalse($setupDatabaseAdapter->hasShopwareTables($connection$testDbName));

            $setupDatabaseAdapter->initializeShopwareDb($connection$testDbName);

            static::assertTrue($setupDatabaseAdapter->hasShopwareTables($connection$testDbName));
        } finally {
            $setupDatabaseAdapter->dropDatabase($connection$testDbName);

            static::assertNotContains($testDbName$setupDatabaseAdapter->getExistingDatabases($connection[]));
        }
    }
}
/** * @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;

        $stopped = false;
        while (iterator_count($coreMigrations->migrateInSteps(null, 1)) === 1) {
            
Home | Imprint | This part of the site doesn't use cookies.