Skip to content

Commit

Permalink
Refactor rename internal method names only
Browse files Browse the repository at this point in the history
  • Loading branch information
rbygrave committed Nov 2, 2023
1 parent 83f6557 commit 872192b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,48 +464,48 @@ public void load(Properties props) {
return;
}
this.properties = props;
dbUsername = getProperty("username", dbUsername);
dbPassword = getProperty("password", dbPassword);
dbUrl = getProperty("url", dbUrl);
dbSchema = getProperty("schema", dbSchema);
skipMigrationRun = getBool("skipMigrationRun", skipMigrationRun);
skipChecksum = getBool("skipChecksum", skipChecksum);
earlyChecksumMode = getBool("earlyChecksumMode", earlyChecksumMode);
createSchemaIfNotExists = getBool("createSchemaIfNotExists", createSchemaIfNotExists);
setCurrentSchema = getBool("setCurrentSchema", setCurrentSchema);
basePlatform = getProperty("basePlatform", basePlatform);
platform = getProperty("platform", getProperty("platformName", platform));
metaTable = getProperty("metaTable", metaTable);
migrationPath = getProperty("migrationPath", migrationPath);
migrationInitPath = getProperty("migrationInitPath", migrationInitPath);
runPlaceholders = getProperty("placeholders", runPlaceholders);
minVersion = getProperty("minVersion", minVersion);
minVersionFailMessage = getProperty("minVersionFailMessage", minVersionFailMessage);

String patchInsertOn = getProperty("patchInsertOn");
dbUsername = property("username", dbUsername);
dbPassword = property("password", dbPassword);
dbUrl = property("url", dbUrl);
dbSchema = property("schema", dbSchema);
skipMigrationRun = property("skipMigrationRun", skipMigrationRun);
skipChecksum = property("skipChecksum", skipChecksum);
earlyChecksumMode = property("earlyChecksumMode", earlyChecksumMode);
createSchemaIfNotExists = property("createSchemaIfNotExists", createSchemaIfNotExists);
setCurrentSchema = property("setCurrentSchema", setCurrentSchema);
basePlatform = property("basePlatform", basePlatform);
platform = property("platform", property("platformName", platform));
metaTable = property("metaTable", metaTable);
migrationPath = property("migrationPath", migrationPath);
migrationInitPath = property("migrationInitPath", migrationInitPath);
runPlaceholders = property("placeholders", runPlaceholders);
minVersion = property("minVersion", minVersion);
minVersionFailMessage = property("minVersionFailMessage", minVersionFailMessage);

String patchInsertOn = property("patchInsertOn");
if (patchInsertOn != null) {
setPatchInsertOn(patchInsertOn);
}
String patchResetChecksumOn = getProperty("patchResetChecksumOn");
String patchResetChecksumOn = property("patchResetChecksumOn");
if (patchResetChecksumOn != null) {
setPatchResetChecksumOn(patchResetChecksumOn);
}
String runPlaceholders = getProperty("runPlaceholders");
String runPlaceholders = property("runPlaceholders");
if (runPlaceholders != null) {
setRunPlaceholders(runPlaceholders);
}
}

private boolean getBool(String key, boolean value) {
String val = getProperty(key);
private boolean property(String key, boolean value) {
String val = property(key);
return val != null ? Boolean.parseBoolean(val) : value;
}

private String getProperty(String key) {
return getProperty(key, null);
private String property(String key) {
return property(key, null);
}

private String getProperty(String key, String defaultVal) {
private String property(String key, String defaultVal) {
String val = properties.getProperty("ebean." + name + ".migration." + key);
if (val != null) {
return val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public List<MigrationResource> checkState() {
* Return the migrations that would be applied if the migration is run.
*/
public List<MigrationResource> checkState(DataSource dataSource) {
return checkState(getConnection(dataSource));
return checkState(connection(dataSource));
}

/**
Expand All @@ -55,7 +55,7 @@ public void run() {
* Run using the connection from the DataSource.
*/
public void run(DataSource dataSource) {
run(getConnection(dataSource));
run(connection(dataSource));
}

/**
Expand All @@ -65,7 +65,7 @@ public void run(Connection connection) {
run(connection, false);
}

private Connection getConnection(DataSource dataSource) {
private Connection connection(DataSource dataSource) {
String username = migrationConfig.getDbUsername();
try {
if (username == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private MigrationTable initialiseMigrationTable(Connection connection) {
private List<MigrationResource> runMigrations(List<LocalMigrationResource> localVersions, MigrationTable table, boolean checkStateMode) throws SQLException {
// get the migrations in version order
if (table.isEmpty()) {
LocalMigrationResource initVersion = getInitVersion();
LocalMigrationResource initVersion = lastInitVersion();
if (initVersion != null) {
// run using a dbinit script
log.log(INFO, "dbinit migration version:{0} local migrations:{1} checkState:{2}", initVersion, localVersions.size(), checkStateMode);
Expand All @@ -105,7 +105,7 @@ private List<MigrationResource> runMigrations(List<LocalMigrationResource> local
/**
* Return the last init migration.
*/
private LocalMigrationResource getInitVersion() {
private LocalMigrationResource lastInitVersion() {
LocalMigrationResources initResources = new LocalMigrationResources(migrationConfig);
if (initResources.readInitResources()) {
List<LocalMigrationResource> initVersions = initResources.versions();
Expand Down

0 comments on commit 872192b

Please sign in to comment.