Skip to content

Commit

Permalink
Merge pull request #42 from vsalaman/db_remove_stdout
Browse files Browse the repository at this point in the history
Removes default output to STDOUT on createSchema.
  • Loading branch information
ar authored Aug 25, 2016
2 parents 0eadb4a + 35b9adb commit 070dbab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions modules/dbsupport/src/main/java/org/jpos/ee/DB.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,19 @@ public void createSchema(String outputFile, boolean create) throws HibernateExce
try {
// SchemaExport export = new SchemaExport(getMetadata());
SchemaExport export = new SchemaExport();
EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.STDOUT);
List<TargetType> targetTypes=new ArrayList<>();
if (outputFile != null) {
export.setOutputFile(outputFile);
export.setDelimiter(";");
targetTypes.add(TargetType.SCRIPT);
if(outputFile.trim().equals("-")) targetTypes.add(TargetType.STDOUT);
else {
export.setOutputFile(outputFile);
export.setDelimiter(";");
targetTypes.add(TargetType.SCRIPT);
}
}
if (create)
targetTypes.add(TargetType.DATABASE);
export.create(targetTypes, getMetadata());
if(targetTypes.size()>0)
export.create(EnumSet.copyOf(targetTypes), getMetadata());
}
catch (IOException | ConfigurationException e)
{
Expand Down

0 comments on commit 070dbab

Please sign in to comment.