Skip to content

Commit

Permalink
Updated schema migration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Westberg committed Jun 12, 2020
1 parent 203cdbe commit c939a1b
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -191,13 +191,14 @@ public Collection<WorkItem> run(Path scratchPath) {
var storedState = stored.stream()
.filter(ss -> ss.prId().equals(state.prId()))
.findAny();
if (storedState.isPresent()) {
// The stored entry could be old and be missing commit information - if so, upgrade it
if (storedState.get().commitId().isPresent() && storedState.get().commitId().get().equals(Hash.zero())) {
var hash = resultingCommitHashFor(pr);
storedState = Optional.of(new PullRequestState(pr, issues, hash));
}
// The stored entry could be old and be missing commit information - if so, upgrade it
if (storedState.isPresent() && storedState.get().commitId().equals(Optional.of(Hash.zero()))) {
var hash = resultingCommitHashFor(pr);
storedState = Optional.of(new PullRequestState(pr, storedState.get().issueIds(), hash));
storage.put(storedState.get());
}

if (storedState.isPresent()) {
var storedIssues = storedState.get().issueIds();
storedIssues.stream()
.filter(issue -> !issues.contains(issue))
Expand Down

0 comments on commit c939a1b

Please sign in to comment.