Search in sources :

Example 1 with MigrationConfigurationModule

use of org.sonar.server.platform.db.migration.MigrationConfigurationModule in project sonarqube by SonarSource.

the class SQDatabase method executeDbMigrations.

private void executeDbMigrations(NoopDatabase noopDatabase) {
    SpringComponentContainer container = new SpringComponentContainer();
    container.add(noopDatabase);
    MigrationConfigurationModule migrationConfigurationModule = new MigrationConfigurationModule();
    migrationConfigurationModule.configure(container);
    // dependencies required by DB migrations
    container.add(SonarRuntimeImpl.forSonarQube(Version.create(8, 0), SonarQubeSide.SERVER, SonarEdition.COMMUNITY));
    container.add(UuidFactoryFast.getInstance());
    container.add(System2.INSTANCE);
    container.add(MapSettings.class);
    container.startComponents();
    MigrationContainer migrationContainer = new MigrationContainerImpl(container, H2StepExecutor.class);
    MigrationSteps migrationSteps = migrationContainer.getComponentByType(MigrationSteps.class);
    MigrationStepsExecutor executor = migrationContainer.getComponentByType(MigrationStepsExecutor.class);
    executor.execute(migrationSteps.readAll());
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) MigrationContainer(org.sonar.server.platform.db.migration.engine.MigrationContainer) MigrationConfigurationModule(org.sonar.server.platform.db.migration.MigrationConfigurationModule) MigrationStepsExecutor(org.sonar.server.platform.db.migration.step.MigrationStepsExecutor) MigrationContainerImpl(org.sonar.server.platform.db.migration.engine.MigrationContainerImpl) MigrationSteps(org.sonar.server.platform.db.migration.step.MigrationSteps)

Example 2 with MigrationConfigurationModule

use of org.sonar.server.platform.db.migration.MigrationConfigurationModule in project sonarqube by SonarSource.

the class PlatformLevel2 method configureLevel.

@Override
protected void configureLevel() {
    add(new MigrationConfigurationModule(), DatabaseVersion.class, DatabaseServerCompatibility.class, MigrationEsClientImpl.class, new StartupMetadataProvider(), DefaultServerUpgradeStatus.class, Durations.class, // index.html cache
    WebPagesCache.class, // plugins
    PluginJarLoader.class, ServerPluginRepository.class, ServerPluginManager.class, ServerPluginJarExploder.class, PluginClassLoader.class, PluginCompressor.class, PluginClassloaderFactory.class, InstalledPluginReferentialFactory.class, WebServerExtensionInstaller.class, // depends on plugins
    ServerI18n.class, OfficialDistribution.class);
    // Migration state must be kept at level2 to survive moving in and then out of safe mode
    // ExecutorService must be kept at level2 because stopping it when stopping safe mode level causes error making SQ fail
    add(DatabaseMigrationStateImpl.class, DatabaseMigrationExecutorServiceImpl.class);
    addIfStartupLeader(DatabaseCharsetChecker.class, CheckDatabaseCharsetAtStartup.class);
}
Also used : MigrationConfigurationModule(org.sonar.server.platform.db.migration.MigrationConfigurationModule) StartupMetadataProvider(org.sonar.server.platform.StartupMetadataProvider)

Aggregations

MigrationConfigurationModule (org.sonar.server.platform.db.migration.MigrationConfigurationModule)2 SpringComponentContainer (org.sonar.core.platform.SpringComponentContainer)1 StartupMetadataProvider (org.sonar.server.platform.StartupMetadataProvider)1 MigrationContainer (org.sonar.server.platform.db.migration.engine.MigrationContainer)1 MigrationContainerImpl (org.sonar.server.platform.db.migration.engine.MigrationContainerImpl)1 MigrationSteps (org.sonar.server.platform.db.migration.step.MigrationSteps)1 MigrationStepsExecutor (org.sonar.server.platform.db.migration.step.MigrationStepsExecutor)1