Skip to content

Commit

Permalink
Merge pull request #1461 from liquibase/LB-209
Browse files Browse the repository at this point in the history
Fix issue with formatted SQL overwriting first changeset during diffToChangeLog LB-209
  • Loading branch information
nvoxland committed Oct 9, 2020
2 parents 66277fe + 1291438 commit aae1f01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ public DbTypes getDbType() {
try {
enterpriseDb = getDatabaseFullVersion().toLowerCase().contains("enterprisedb");
} catch (DatabaseException e) {
Scope.getCurrentScope().getLog(getClass()).severe("Can't get full version of Postgres DB. Used EDB as default", e);
return DbTypes.EDB;
if (getConnection() != null) {
Scope.getCurrentScope().getLog(getClass()).severe("Can't get full version of Postgres DB. Used EDB as default", e);
return DbTypes.EDB;
}
}
return enterpriseDb ? DbTypes.EDB : DbTypes.COMMUNITY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ public void run() {
randomAccessFile.writeBytes(DATABASE_CHANGE_LOG_CLOSING_XML_TAG + lineSeparator);
} else {
randomAccessFile.seek(0);
randomAccessFile.write(xml.getBytes(LiquibaseConfiguration.getInstance().getConfiguration
long length = randomAccessFile.length();
randomAccessFile.seek(length);
randomAccessFile.write(
xml.getBytes(LiquibaseConfiguration.getInstance().getConfiguration
(GlobalConfiguration.class).getOutputEncoding()));
}
randomAccessFile.close();
}

}
Expand Down

0 comments on commit aae1f01

Please sign in to comment.