Search in sources :

Example 1 with MigrationContainerImpl

use of org.sonar.server.platform.db.migration.engine.MigrationContainerImpl 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)

Aggregations

SpringComponentContainer (org.sonar.core.platform.SpringComponentContainer)1 MigrationConfigurationModule (org.sonar.server.platform.db.migration.MigrationConfigurationModule)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