@Override public void afterPropertiesSet() throws LiquibaseException { if (!env.acceptsProfiles(SPRING_PROFILE_NO_LIQUIBASE)) { if (env.acceptsProfiles(SPRING_PROFILE_DEVELOPMENT, SPRING_PROFILE_HEROKU)) { taskExecutor.execute(() -> { try { logger.warn(STARTING_ASYNC_MESSAGE); initDb(); } catch (LiquibaseException e) { logger.error(EXCEPTION_MESSAGE, e.getMessage(), e); } }); } else { logger.debug(STARTING_SYNC_MESSAGE); initDb(); } } else { logger.debug(DISABLED_MESSAGE); } }
throw new LiquibaseException("Missing Class '" + e.getMessage() + "'. Database " + "driver may not be included in the project " + "dependencies or with wrong scope."); } catch (ReflectiveOperationException e) { throw new LiquibaseException("Failed to load JDBC driver, " + driver, e); Connection connection = dbDriver.connect(url, info); if (connection == null) { throw new LiquibaseException("Connection could not be created to " + url + " with driver " + dbDriver.getClass().getName() + ". Possibly the wrong driver for the given " throw new LiquibaseException(e);
} catch (LiquibaseException e) { e.printStackTrace();
if (!liquibase.isSafeToRunUpdate()) { if (UIFactory.getInstance().getFacade().promptForNonLocalDatabase(liquibase.getDatabase())) { throw new LiquibaseException("User decided not to run against non-local database"); throw new MojoExecutionException("Error setting up or running Liquibase: " + e.getMessage(), e);
throw new LiquibaseException("Could not resolve changeLogLocationPattern", e);
@Override public void afterPropertiesSet() throws LiquibaseException { if (!env.acceptsProfiles(SPRING_PROFILE_NO_LIQUIBASE)) { if (env.acceptsProfiles(SPRING_PROFILE_DEVELOPMENT, SPRING_PROFILE_HEROKU)) { // Prevent Thread Lock with spring-cloud-context GenericScope // https://github.com/spring-cloud/spring-cloud-commons/commit/aaa7288bae3bb4d6fdbef1041691223238d77b7b#diff-afa0715eafc2b0154475fe672dab70e4R328 try (Connection connection = getDataSource().getConnection()) { taskExecutor.execute(() -> { try { logger.warn(STARTING_ASYNC_MESSAGE); initDb(); } catch (LiquibaseException e) { logger.error(EXCEPTION_MESSAGE, e.getMessage(), e); } }); } catch (SQLException e) { logger.error(EXCEPTION_MESSAGE, e.getMessage(), e); } } else { logger.debug(STARTING_SYNC_MESSAGE); initDb(); } } else { logger.debug(DISABLED_MESSAGE); } }
public void processSchemaLiquibase(List<String>schemas) throws LiquibaseException { Liquibase liquibase = null; if (schemas == null) { schemas = new ArrayList<>(); schemas.add("public"); } for (String schema : schemas) { Connection c = null; try { c = dataSource.getConnection(); setDefaultSchema(schema); c.setSchema(schema); liquibase = createLiquibase(c); performUpdate(liquibase); } catch (Exception e) { throw new LiquibaseException(e); } finally { if (c != null) { try { c.rollback(); c.close(); } catch (SQLException e) { //nothing to do } } } } } }
"Error during try to connection the database.", e); } catch (LiquibaseException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw new LQMGException( "Error during processing XML file; "
public void afterPropertiesSet() throws Exception { if (this.dataSource == null && this.schemas == null) { this.log.info("DataSources based multitenancy enabled"); this.resolveDataSources(); this.runOnAllDataSources(); } else { if (this.dataSource == null && this.schemas != null) { throw new LiquibaseException("When schemas are defined you should also define a base dataSource"); } if (this.dataSource != null) { this.log.info("Schema based multitenancy enabled"); if (this.schemas == null || this.schemas.isEmpty()) { this.log.warning("Schemas not defined, using defaultSchema only"); this.schemas = new ArrayList(); this.schemas.add(this.defaultSchema); } this.runOnAllSchemas(); } } }
throw new LiquibaseException("Could not create the class loader, " + e, e); throw new LiquibaseException(e);
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); } } } }
throw new LiquibaseException("Could not create the class loader, " + e, e); throw new LiquibaseException(e);
@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); } } }
@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); } } } }