@Override public void run(Namespace namespace, Liquibase liquibase) throws Exception { final String context = getContext(namespace); final Integer count = namespace.getInt("count"); if (count != null) { liquibase.futureRollbackSQL(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.futureRollbackSQL(context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } }
@Override public void run(Namespace namespace, Liquibase liquibase) throws Exception { final String context = getContext(namespace); final Integer count = namespace.getInt("count"); if (count != null) { liquibase.futureRollbackSQL(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.futureRollbackSQL(context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } }
@Override protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseException { liquibase.futureRollbackSQL(new Contexts(contexts), new LabelExpression(labels), outputWriter); }
liquidbase.rollback(count, context, dbMaintenance.createConsoleOutput()); } else { liquidbase.futureRollbackSQL(context, dbMaintenance.createConsoleOutput()); liquidbase.rollback(count, context); } else { liquidbase.futureRollbackSQL(context, dbMaintenance.createConsoleOutput());
public void verify(DataSource ds) { boolean throwException = false; Contexts contexts = new Contexts(""); for(LiquibaseConfiguration c : configs) { try(Connection con = ds.getConnection()) { Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(con)); db.setDatabaseChangeLogLockTableName(c.changeLogLockTableName()); db.setDatabaseChangeLogTableName(c.changeLogTableName()); Liquibase liquibase = new ShureviewNonCreationLiquibase(c.liquibaseResource(), new ClassLoaderResourceAccessor(), db); liquibase.getLog(); liquibase.validate(); List<ChangeSet> listUnrunChangeSets = liquibase.listUnrunChangeSets(contexts, new LabelExpression()); if(!listUnrunChangeSets.isEmpty()) { StringWriter writer = new StringWriter(); liquibase.update(contexts, writer); liquibase.futureRollbackSQL(writer); log.warn(writer.toString()); throwException = true; } } catch (SQLException | LiquibaseException e) { throw new RuntimeException("Failed to verify database.", e); } } if(throwException){ throw new RuntimeException("Unrun changesets in chengelog."); } }
private void generateRollbackFile(Liquibase liquibase) throws LiquibaseException { if (this.rollbackFile != null) { OutputStreamWriter output = null; try { output = new OutputStreamWriter(new FileOutputStream(this.rollbackFile), ((GlobalConfiguration)LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class)).getOutputEncoding()); if (this.tag != null) { liquibase.futureRollbackSQL(this.tag, new Contexts(this.getContexts()), new LabelExpression(this.getLabels()), output); } else { liquibase.futureRollbackSQL(new Contexts(this.getContexts()), new LabelExpression(this.getLabels()), output); } } catch (IOException var11) { throw new LiquibaseException("Unable to generate rollback file.", var11); } finally { try { if (output != null) { output.close(); } } catch (IOException var10) { this.log.severe("Error closing output", var10); } } } }
StringWriter writer = new StringWriter(); liquibase.update(contexts, writer); liquibase.futureRollbackSQL(writer); log.warn(writer.toString()); throwException = true;