本文整理了Java中liquibase.Liquibase.rollback()
方法的一些代码示例,展示了Liquibase.rollback()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Liquibase.rollback()
方法的具体详情如下:
包路径:liquibase.Liquibase
类名称:Liquibase
方法名:rollback
暂无
代码示例来源:origin: dropwizard/dropwizard
@Override
public void run(Namespace namespace, Liquibase liquibase) throws Exception {
final String tag = namespace.getString("tag");
final Integer count = namespace.getInt("count");
final Date date = namespace.get("date");
final boolean dryRun = namespace.getBoolean("dry-run") == null ? false : namespace.getBoolean("dry-run");
final String context = getContext(namespace);
if (Stream.of(tag, count, date).filter(Objects::nonNull).count() != 1) {
throw new IllegalArgumentException("Must specify either a count, a tag, or a date.");
}
if (count != null) {
if (dryRun) {
liquibase.rollback(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
} else {
liquibase.rollback(count, context);
}
} else if (tag != null) {
if (dryRun) {
liquibase.rollback(tag, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
} else {
liquibase.rollback(tag, context);
}
} else {
if (dryRun) {
liquibase.rollback(date, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
} else {
liquibase.rollback(date, context);
}
}
}
代码示例来源:origin: io.dropwizard/dropwizard-migrations
@Override
public void run(Namespace namespace, Liquibase liquibase) throws Exception {
final String tag = namespace.getString("tag");
final Integer count = namespace.getInt("count");
final Date date = namespace.get("date");
final Boolean dryRun = firstNonNull(namespace.getBoolean("dry-run"), false);
final String context = getContext(namespace);
if (Stream.of(tag, count, date).filter(Objects::nonNull).count() != 1) {
throw new IllegalArgumentException("Must specify either a count, a tag, or a date.");
}
if (count != null) {
if (dryRun) {
liquibase.rollback(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
} else {
liquibase.rollback(count, context);
}
} else if (tag != null) {
if (dryRun) {
liquibase.rollback(tag, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
} else {
liquibase.rollback(tag, context);
}
} else {
if (dryRun) {
liquibase.rollback(date, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
} else {
liquibase.rollback(date, context);
}
}
}
代码示例来源:origin: com.expanset.utils/utils-dbmigration
liquidbase.rollback(tag, context, dbMaintenance.createConsoleOutput());
} else if (StringUtils.isNotEmpty(date)) {
liquidbase.rollback(format.parse(date), context, dbMaintenance.createConsoleOutput());
} else if (count != null) {
liquidbase.rollback(count, context, dbMaintenance.createConsoleOutput());
} else {
liquidbase.futureRollbackSQL(context, dbMaintenance.createConsoleOutput());
liquidbase.rollback(tag, context);
} else if (StringUtils.isNotEmpty(date)) {
liquidbase.rollback(format.parse(date), context);
} else if (count != null) {
liquidbase.rollback(count, context);
} else {
liquidbase.futureRollbackSQL(context, dbMaintenance.createConsoleOutput());
代码示例来源:origin: org.liquibase/liquibase-maven-plugin
@Override
protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseException {
switch (type) {
case COUNT: {
liquibase.rollback(rollbackCount, rollbackScript, new Contexts(contexts), new LabelExpression(labels));
break;
}
case DATE: {
try {
liquibase.rollback(parseDate(rollbackDate), rollbackScript,new Contexts(contexts), new LabelExpression(labels));
}
catch (ParseException e) {
String message = "Error parsing rollbackDate: " + e.getMessage();
throw new LiquibaseException(message, e);
}
break;
}
case TAG: {
liquibase.rollback(rollbackTag, rollbackScript,new Contexts(contexts), new LabelExpression(labels));
break;
}
default: {
throw new IllegalStateException("Unexpected rollback type, " + type);
}
}
}
代码示例来源:origin: org.liquibase/liquibase-maven-plugin
@Override
protected void performLiquibaseTask(Liquibase liquibase)
throws LiquibaseException {
switch (type) {
case COUNT: {
liquibase.rollback(rollbackCount, rollbackScript,new Contexts(contexts), new LabelExpression(labels), outputWriter);
break;
}
case DATE: {
try {
liquibase.rollback(parseDate(rollbackDate), rollbackScript,new Contexts(contexts), new LabelExpression(labels),
outputWriter);
} catch (ParseException e) {
String message = "Error parsing rollbackDate: "
+ e.getMessage();
throw new LiquibaseException(message, e);
}
break;
}
case TAG: {
liquibase.rollback(rollbackTag, rollbackScript,new Contexts(contexts), new LabelExpression(labels), outputWriter);
break;
}
default: {
throw new IllegalStateException("Unexpected rollback type, " + type);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!