Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add result column to migration table #6580

Merged
merged 19 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix regression
  • Loading branch information
fil512 committed Jan 6, 2025
commit 906b461e26f436d48c6235db57336fa881a2982e
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private int doExecuteSql(@Language("SQL") String theSql, Object... theArguments)
} else {
int changesCount = jdbcTemplate.update(theSql, theArguments);
logInfo(ourLog, "SQL \"{}\" returned {}", theSql, changesCount);
myExecutionResult = MigrationTaskExecutionResultEnum.SUCCESS;
myExecutionResult = MigrationTaskExecutionResultEnum.APPLIED;
return changesCount;
}
} catch (DataAccessException e) {
Expand All @@ -220,7 +220,7 @@ private int doExecuteSql(@Language("SQL") String theSql, Object... theArguments)
"Task {} did not exit successfully on doExecuteSql(), but task is allowed to fail",
getMigrationVersion());
ourLog.debug("Error was: {}", e.getMessage(), e);
myExecutionResult = MigrationTaskExecutionResultEnum.ALLOWED_TO_FAIL;
myExecutionResult = MigrationTaskExecutionResultEnum.NOT_APPLIED_ALLOWED_FAILURE;
return 0;
} else {
throw new HapiMigrationException(
Expand Down Expand Up @@ -265,13 +265,13 @@ public JdbcTemplate newJdbcTemplate() {
public void execute() throws SQLException {
if (myFlags.contains(TaskFlagEnum.DO_NOTHING)) {
ourLog.info("Skipping stubbed task: {}", getDescription());
myExecutionResult = MigrationTaskExecutionResultEnum.SKIPPED;
myExecutionResult = MigrationTaskExecutionResultEnum.NOT_APPLIED_SKIPPED;
return;
}
if (!myOnlyAppliesToPlatforms.isEmpty()) {
if (!myOnlyAppliesToPlatforms.contains(getDriverType())) {
ourLog.info("Skipping task {} as it does not apply to {}", getDescription(), getDriverType());
myExecutionResult = MigrationTaskExecutionResultEnum.DOES_NOT_APPLY;
myExecutionResult = MigrationTaskExecutionResultEnum.NOT_APPLIED_NOT_FOR_THIS_DATABASE;
return;
}
}
Expand All @@ -282,7 +282,7 @@ public void execute() throws SQLException {
ourLog.info(
"Skipping task since one of the preconditions was not met: {}",
precondition.getPreconditionReason());
myExecutionResult = MigrationTaskExecutionResultEnum.PRECONDITION_FAILED;
myExecutionResult = MigrationTaskExecutionResultEnum.NOT_APPLIED_PRECONDITION_NOT_MET;
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ public enum MigrationTaskExecutionResultEnum {
/**
* Was either skipped via the `skip-versions` flag or the migration task was stubbed
*/
SKIPPED,
NOT_APPLIED_SKIPPED,

/**
* This migration task does not apply to this database
*/
DOES_NOT_APPLY,
NOT_APPLIED_NOT_FOR_THIS_DATABASE,

/**
* This migration task had precondition criteria (expressed as SQL) that was not met
*/
PRECONDITION_FAILED,
NOT_APPLIED_PRECONDITION_NOT_MET,

/**
* The migration failed, but the task has the FAILURE_ALLOWED flag set.
*/
ALLOWED_TO_FAIL,
NOT_APPLIED_ALLOWED_FAILURE,

/**
* The migration executed successfully
* The migration was applied
*/
SUCCESS,
APPLIED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void testFailureAllowed(Supplier<TestDatabaseDetails> theTestDatabaseDeta

List<HapiMigrationEntity> entities = myHapiMigrationDao.findAll();
assertThat(entities).hasSize(1);
assertThat(entities.get(0).getResult()).isEqualTo(MigrationTaskExecutionResultEnum.ALLOWED_TO_FAIL.name());
assertThat(entities.get(0).getResult()).isEqualTo(MigrationTaskExecutionResultEnum.NOT_APPLIED_ALLOWED_FAILURE.name());
}

@ParameterizedTest(name = "{index}: {0}")
Expand Down
Loading