@Bean @DependsOn ("liquibaseSchemaCommonTables") public SpringLiquibase liquibasePublicSchema() { SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setDataSource(dataSource); liquibase.setDefaultSchema("public"); liquibase.setChangeLog("classpath:migration/publicSchemaOnly/release.xml"); return liquibase; }
@PostConstruct protected void installCoreSchema() throws LiquibaseException { int installedVersion = getInstalledVersion(); if ( installedVersion != EXPECTED_VERSION ) { LOG.info( "Installing the core schema for Across" ); SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setChangeLog( "classpath:" + getClass().getName().replace( '.', '/' ) + ".xml" ); liquibase.setDataSource( dataSource ); liquibase.setResourceLoader( applicationContext ); if ( defaultSchema != null ) { liquibase.setDefaultSchema( defaultSchema ); } liquibase.afterPropertiesSet(); updateInstalledVersion( EXPECTED_VERSION ); } else { LOG.debug( "Core schema for Across already installed, version {}", EXPECTED_VERSION ); } }
@Bean @DependsOn("dataSource") public SpringLiquibase liquibase() { SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setDataSource(dataSource); liquibase.setChangeLog("classpath:META-INF/liquibase/application-changes.xml"); liquibase.setContexts("default"); liquibase.setDefaultSchema(databaseProperties.getJdbcSchema()); liquibase.setChangeLogParameters(createChangeLogParameters()); return liquibase;
/** * This method configures the {@link SpringLiquibase} object before running the liquibase installer. * <p> * This implementation will set the {@link SpringLiquibase} objects changelogParameters, changelog, * default schema and data source based on this {@link AcrossLiquibaseInstaller} configuration. * <p> * Extensible if you need to perform some extra configuration on the {@link SpringLiquibase} object. * * @return The configured @link SpringLiquibase} object - before {@link SpringLiquibase#afterPropertiesSet()} */ protected SpringLiquibase createSpringLiquibase() { SpringLiquibase springLiquibase = new SpringLiquibase(); springLiquibase.setChangeLogParameters( buildParameters( getSchemaConfiguration() ) ); springLiquibase.setChangeLog( getChangelog() ); if ( StringUtils.isNotEmpty( getDefaultSchema() ) ) { springLiquibase.setDefaultSchema( getDefaultSchema() ); } else if ( getSchemaConfiguration() != null ) { springLiquibase.setDefaultSchema( getSchemaConfiguration().getDefaultSchema() ); } springLiquibase.setDataSource( getDataSource() ); return springLiquibase; }