public class SpringLiquibase extends Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ResourceLoaderAware
db-changelog.xml
from the classpath and apply it against
myDataSource
.
<bean id="myLiquibase" class="liquibase.spring.SpringLiquibase" > <property name="dataSource" ref="myDataSource" /> <property name="changeLog" value="classpath:db-changelog.xml" /> </bean>
Modifier and Type | Field and Description |
---|---|
protected String |
beanName |
protected String |
changeLog |
protected boolean |
clearCheckSums |
protected String |
contexts |
protected String |
databaseChangeLogLockTable |
protected String |
databaseChangeLogTable |
protected DataSource |
dataSource |
protected String |
defaultSchema |
protected boolean |
dropFirst |
protected String |
labelFilter |
protected String |
liquibaseSchema |
protected String |
liquibaseTablespace |
protected Logger |
log |
protected Map<String,String> |
parameters |
protected org.springframework.core.io.ResourceLoader |
resourceLoader |
protected File |
rollbackFile |
protected boolean |
shouldRun |
protected String |
tag |
protected boolean |
testRollbackOnUpdate |
Constructor and Description |
---|
SpringLiquibase() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Executed automatically when the bean is initialized.
|
protected Database |
createDatabase(Connection c,
ResourceAccessor resourceAccessor)
Subclasses may override this method add change some database settings such as
default schema before returning the database object.
|
protected Liquibase |
createLiquibase(Connection c) |
protected SpringResourceAccessor |
createResourceOpener()
Create a new resourceOpener.
|
String |
getBeanName()
Gets the Spring-name of this instance.
|
String |
getChangeLog()
Returns a Resource that is able to resolve to a file or classpath resource.
|
String |
getContexts() |
String |
getDatabaseChangeLogLockTable() |
String |
getDatabaseChangeLogTable() |
String |
getDatabaseProductName() |
DataSource |
getDataSource()
The DataSource that liquibase will use to perform the migration.
|
String |
getDefaultSchema() |
String |
getLabelFilter() |
String |
getLabels()
Deprecated.
use
getLabelFilter() |
String |
getLiquibaseSchema() |
String |
getLiquibaseTablespace() |
org.springframework.core.io.ResourceLoader |
getResourceLoader() |
String |
getTag() |
boolean |
isClearCheckSums() |
boolean |
isDropFirst() |
boolean |
isIgnoreClasspathPrefix() |
boolean |
isTestRollbackOnUpdate()
Returns whether a rollback should be tested at update time or not.
|
protected void |
performUpdate(Liquibase liquibase) |
void |
setBeanName(String name)
Spring sets this automatically to the instance's configured bean name.
|
void |
setChangeLog(String dataModel)
Sets a Spring Resource that is able to resolve to a file or classpath resource.
|
void |
setChangeLogParameters(Map<String,String> parameters) |
void |
setClearCheckSums(boolean clearCheckSums) |
void |
setContexts(String contexts) |
void |
setDatabaseChangeLogLockTable(String databaseChangeLogLockTable) |
void |
setDatabaseChangeLogTable(String databaseChangeLogTable) |
void |
setDataSource(DataSource dataSource)
The DataSource that liquibase will use to perform the migration.
|
void |
setDefaultSchema(String defaultSchema) |
void |
setDropFirst(boolean dropFirst) |
void |
setIgnoreClasspathPrefix(boolean ignoreClasspathPrefix)
Deprecated.
Always ignoring classpath prefix
|
void |
setLabelFilter(String labelFilter) |
void |
setLabels(String labels)
Deprecated.
|
void |
setLiquibaseSchema(String liquibaseSchema) |
void |
setLiquibaseTablespace(String liquibaseTablespace) |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
void |
setRollbackFile(File rollbackFile) |
void |
setShouldRun(boolean shouldRun) |
void |
setTag(String tag) |
void |
setTestRollbackOnUpdate(boolean testRollbackOnUpdate)
If testRollbackOnUpdate is set to true a rollback will be tested at update time.
|
String |
toString() |
protected final Logger log
protected String beanName
protected org.springframework.core.io.ResourceLoader resourceLoader
protected DataSource dataSource
protected String changeLog
protected String contexts
protected String labelFilter
protected String tag
protected String defaultSchema
protected String liquibaseSchema
protected String databaseChangeLogTable
protected String databaseChangeLogLockTable
protected String liquibaseTablespace
protected boolean dropFirst
protected boolean clearCheckSums
protected boolean shouldRun
protected File rollbackFile
protected boolean testRollbackOnUpdate
public boolean isDropFirst()
public void setDropFirst(boolean dropFirst)
public boolean isClearCheckSums()
public void setClearCheckSums(boolean clearCheckSums)
public void setShouldRun(boolean shouldRun)
public String getDatabaseProductName() throws DatabaseException
DatabaseException
public DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public String getChangeLog()
public void setChangeLog(String dataModel)
classpath:db-changelog.xml
.public String getContexts()
public void setContexts(String contexts)
public String getLabels()
getLabelFilter()
public void setLabels(String labels)
setLabelFilter(String)
public String getLabelFilter()
public void setLabelFilter(String labelFilter)
public String getTag()
public void setTag(String tag)
public String getDefaultSchema()
public void setDefaultSchema(String defaultSchema)
public String getLiquibaseTablespace()
public void setLiquibaseTablespace(String liquibaseTablespace)
public String getLiquibaseSchema()
public void setLiquibaseSchema(String liquibaseSchema)
public String getDatabaseChangeLogTable()
public void setDatabaseChangeLogTable(String databaseChangeLogTable)
public String getDatabaseChangeLogLockTable()
public void setDatabaseChangeLogLockTable(String databaseChangeLogLockTable)
public boolean isTestRollbackOnUpdate()
public void setTestRollbackOnUpdate(boolean testRollbackOnUpdate)
testRollbackOnUpdate
- public void afterPropertiesSet() throws LiquibaseException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
LiquibaseException
protected void performUpdate(Liquibase liquibase) throws LiquibaseException
LiquibaseException
protected Liquibase createLiquibase(Connection c) throws LiquibaseException
LiquibaseException
protected Database createDatabase(Connection c, ResourceAccessor resourceAccessor) throws DatabaseException
c
- DatabaseFactory
.DatabaseException
protected SpringResourceAccessor createResourceOpener()
public String getBeanName()
public void setBeanName(String name)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public org.springframework.core.io.ResourceLoader getResourceLoader()
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public void setRollbackFile(File rollbackFile)
public boolean isIgnoreClasspathPrefix()
public void setIgnoreClasspathPrefix(boolean ignoreClasspathPrefix)
Copyright © 2023 Liquibase.org. All rights reserved.