@Override public void run(T configuration, Environment environment) throws Exception { CloseableLiquibase liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(getDataSourceFactory(configuration) .build(environment.metrics(), name()), getMigrationsFileName()); liquibase.update(""); }
@Override public void start() throws Exception { LOGGER.info("begin migration"); final ManagedDataSource dataSource = dataSourceFactory.build(new MetricRegistry(), "liquibase"); try(CloseableLiquibase liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(dataSource, "migrations.xml")) { liquibase.update("migrations"); } LOGGER.info("finish migration"); }
@Override public boolean initialize() { try (CloseableLiquibase liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(configuration .getDataSourceFactory() .build(metricRegistry, "liquibase"), MIGRATIONS_FILENAME)) { liquibase.update(""); return true; } catch (Exception err) { LOGGER.error("Failed to create liquibase", err); throw new IllegalStateException(err); } }
@Before public void setupH2Test() throws Exception { liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(hsqlConfig .getDataSourceFactory() .build(new MetricRegistry(), "liquibase"), JdbiStore.MIGRATIONS_FILENAME); liquibase.update(""); database = new DBIFactory().build(environment(), hsqlConfig.getDataSourceFactory(), "h2test"); database.registerArgumentFactory(new DependencyIdArgumentFactory()); database.registerArgumentFactory(new ServiceIdArgumentFactory()); database.registerArgumentFactory(new TenacityConfigurationArgumentFactory(Jackson.newObjectMapper())); database.registerArgumentFactory(new DateTimeArgumentFactory()); }