本文整理汇总了Java中liquibase.changelog.ChangeLogHistoryService类的典型用法代码示例。如果您正苦于以下问题:Java ChangeLogHistoryService类的具体用法?Java ChangeLogHistoryService怎么用?Java ChangeLogHistoryService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeLogHistoryService类属于liquibase.changelog包,在下文中一共展示了ChangeLogHistoryService类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldUpdate
import liquibase.changelog.ChangeLogHistoryService; //导入依赖的package包/类
/**
* Returns {@code true} if the supplied {@link Liquibase} instance
* should in fact have its {@link Liquibase#update(String)} method
* called.
*
* <p>This implementation returns {@code true} if the {@code
* liquibase.should.run} system property is non-{@code null} and set
* to something other than {@code false} and if the supplied {@link
* Liquibase} instance is non-{@code null} and {@linkplain
* StandardChangeLogHistoryService#hasDatabaseChangeLogTable() is
* connected to a database that does not yet have a
* <code>DATABASECHANGELOG</code> table} in it.</p>
*
* @param liquibase the {@link Liquibase} instance to check; may be
* {@code null} in which case {@code false} will be returned
*
* @return {@code true} if the supplied {@link Liquibase} instance
* should in fact have its {@link Liquibase#update(String)} method
* called
*
* @exception LiquibaseException if there was a Liquibase-related
* error
*
* @exception SQLException if there was a database-related error
*
* @see Liquibase#update(String)
*/
protected boolean shouldUpdate(final Liquibase liquibase) throws LiquibaseException, SQLException {
this.logger.debug("Entering shouldUpdate(Liquibase); parameters: liquibase = " + liquibase);
boolean returnValue = liquibase != null && !"false".equals(System.getProperty("liquibase.should.run"));
if (returnValue) {
final Database database = liquibase.getDatabase();
if (database != null) {
final ChangeLogHistoryService changeLogHistoryService = ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database);
returnValue = !(changeLogHistoryService instanceof StandardChangeLogHistoryService) || !((StandardChangeLogHistoryService)changeLogHistoryService).hasDatabaseChangeLogTable();
}
}
this.logger.debug("Exiting shouldUpdate(Liquibase); returning: " + returnValue);
return returnValue;
}