Skip to content

Commit

Permalink
Merge pull request #164 from Datical/DAT-3640
Browse files Browse the repository at this point in the history
DAT-3640 Add an informational message during generateChangeLog to for…
  • Loading branch information
nvoxland committed Dec 18, 2019
2 parents a6f26cc + 53a62d3 commit a151058
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
import liquibase.snapshot.SnapshotControl;
import liquibase.snapshot.SnapshotGeneratorFactory;
import liquibase.util.StringUtils;
import liquibase.logging.LogService;
import liquibase.logging.LogType;

import java.io.PrintStream;

public class GenerateChangeLogCommand extends DiffToChangeLogCommand {
private static final String INFO_MESSAGE =
"When generating formatted SQL changelogs, it is important to decide if batched statements\n" +
"should be split (splitStatements:true is the default behavior) or not (splitStatements:false).\n" +
"See http://liquibase.org for additional documentation.";

private String author;
private String context;
Expand Down Expand Up @@ -43,6 +49,12 @@ public GenerateChangeLogCommand setContext(String context) {

@Override
protected CommandResult run() throws Exception {
String changeLogFile = StringUtils.trimToNull(getChangeLogFile());
if (changeLogFile.toLowerCase().endsWith(".sql")) {
System.out.println("\n" + INFO_MESSAGE + "\n");
LogService.getLog(getClass()).info(LogType.LOG, "\n" + INFO_MESSAGE + "\n");
}

SnapshotCommand.logUnsupportedDatabase(this.getReferenceDatabase(), this.getClass());

DiffResult diffResult = createDiffResult();
Expand Down

0 comments on commit a151058

Please sign in to comment.