/** * Return the DB password to use for running DB migrations. */ public String getDbPassword() { String user = readEnvironment("ddl.migration.password"); if (user != null) { return user; } return dbPassword; }
/** * Return a comma and equals delimited placeholders that are substituted in SQL scripts when running migration * (used by DB Migration runner only). */ public String getRunPlaceholders() { // environment properties take precedence String placeholders = readEnvironment("ddl.migration.placeholders"); if (placeholders != null) { return placeholders; } return runPlaceholders; }
/** * Return the DB username to use for running DB migrations. */ public String getDbUsername() { // environment properties take precedence String user = readEnvironment("ddl.migration.user"); if (user != null) { return user; } return dbUsername; }
/** * Return true if the DB migration should be run on startup. */ public boolean isRunMigration() { // environment properties take precedence String run = readEnvironment("ddl.migration.run"); if (run != null) { return "true".equalsIgnoreCase(run.trim()); } return runMigration; }
/** * Return the migration version (typically FlywayDb compatible). * <p> * Example: 1.1.1_2 * <p> * The version is expected to be the combination of the current pom version plus * a 'feature' id. The combined version must be unique and ordered to work with * FlywayDb so each developer sets a unique version so that the migration script * generated is unique (typically just prior to being submitted as a merge request). */ public String getVersion() { String envVersion = readEnvironment("ddl.migration.version"); if (!isEmpty(envVersion)) { return envVersion.trim(); } return version; }
/** * Return the migration name which is short description text that can be appended to * the migration version to become the ddl script file name. * <p> * So if the name is "a foo table" then the ddl script file could be: * "1.1.1_2__a-foo-table.sql" * </p> * <p> * When the DB migration relates to a git feature (merge request) then this description text * is a short description of the feature. * </p> */ public String getName() { String envName = readEnvironment("ddl.migration.name"); if (!isEmpty(envName)) { return envName.trim(); } return name; }