use of org.sonar.server.platform.db.migration.engine.MigrationContainer 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());
}
Aggregations