@Bean
  public SpringLiquibase liquibase(
      DataSource dataSource,
      DataSourceProperties dataSourceProperties,
      LiquibaseProperties liquibaseProperties) {

    // Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start
    // asynchronously
    SpringLiquibase liquibase = new AsyncSpringLiquibase();
    liquibase.setDataSource(dataSource);
    liquibase.setChangeLog("classpath:config/liquibase/master.xml");
    liquibase.setContexts(liquibaseProperties.getContexts());
    liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
    liquibase.setDropFirst(liquibaseProperties.isDropFirst());
    liquibase.setShouldRun(liquibaseProperties.isEnabled());
    if (env.acceptsProfiles(Constants.SPRING_PROFILE_FAST)) {
      if ("org.h2.jdbcx.JdbcDataSource".equals(dataSourceProperties.getDriverClassName())) {
        liquibase.setShouldRun(true);
        log.warn(
            "Using '{}' profile with H2 database in memory is not optimal, you should consider switching to"
                + " MySQL or Postgresql to avoid rebuilding your database upon each start.",
            Constants.SPRING_PROFILE_FAST);
      } else {
        liquibase.setShouldRun(false);
      }
    } else {
      log.debug("Configuring Liquibase");
    }
    return liquibase;
  }
 @Bean
 public SpringLiquibase liquibase() {
   log.debug("Configuring Liquibase");
   SpringLiquibase liquibase = new SpringLiquibase();
   liquibase.setDataSource(dataSource());
   liquibase.setChangeLog("classpath:config/liquibase/master.xml");
   liquibase.setContexts("development, production");
   return liquibase;
 }
예제 #3
0
 @Bean
 public SpringLiquibase liquibase(DataSource dataSource) {
   SpringLiquibase liquibase = new SpringLiquibase();
   liquibase.setDataSource(dataSource);
   liquibase.setChangeLog("classpath:config/liquibase/master.xml");
   liquibase.setContexts(liquiBasePropertyResolver.getProperty("context"));
   if (env.acceptsProfiles(Constants.SPRING_PROFILE_FAST)) {
     if ("org.h2.jdbcx.JdbcDataSource"
         .equals(dataSourcePropertyResolver.getProperty("dataSourceClassName"))) {
       liquibase.setShouldRun(true);
       log.warn(
           "Using '{}' profile with H2 database in memory is not optimal, you should consider switching to"
               + " MySQL or Postgresql to avoid rebuilding your database upon each start.",
           Constants.SPRING_PROFILE_FAST);
     } else {
       liquibase.setShouldRun(false);
     }
   } else {
     log.debug("Configuring Liquibase");
   }
   return liquibase;
 }