Skip to content

Commit

Permalink
Fix #2700 Add a flyway:timestamp default placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyeeedar committed Mar 4, 2020
1 parent 7f977ae commit 195fd77
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@
import org.flywaydb.core.internal.database.base.Schema;

import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;

public class ParsingContext {
private static final Log LOG = LogFactory.getLog(ParsingContext.class);

private static final String DEFAULT_SCHEMA_PLACEHOLDER = "flyway:defaultSchema";
private static final String USER_PLACEHOLDER = "flyway:user";
private static final String DATABASE_PLACEHOLDER = "flyway:database";
private static final String TIMESTAMP_PLACEHOLDER = "flyway:timestamp";

private Map<String, String> placeholders = new HashMap<>();

Expand All @@ -52,6 +57,7 @@ public void populate(Database database) {
}

placeholders.put(USER_PLACEHOLDER, currentUser);
placeholders.put(TIMESTAMP_PLACEHOLDER, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
}

private String getCatalog(Database database) {
Expand Down

0 comments on commit 195fd77

Please sign in to comment.