Add "./dspace database skip" command to optionally skip older migrations #8611
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Several users have encountered issues with older, ignored
5.7.*
migrations (specifically5.7.2017.04.11
and5.7.2017.05.05
) when running the./dspace database migrate ignored
command to upgrade from 6.x to 7.x.Description
Adds the
./dspace database skip [version]
command, which allows you to skip applying a single ("Pending" or "Ignored") migration. Behind the scenes, this command tells Flyway that the skipped migration has already been run. Therefore, once a migration is skipped, it will not be run again in the future.This PR looks larger than it really is, as I also refactored
DatabaseUtils.main()
to use aswitch
instead of a series ofif/else if
statements -- this makes the code much more readable. But,git
seems to think I modified most of themain()
method, when I've just realigned code to fit within theswitch / case
statements.Instructions for Reviewers
./dspace database skip [version]
command is to find a database which has not run either the5.7.2017.04.11
or5.7.2017.05.05
migrations../dspace database info
to verify one (or both) of the 5.7 migrations appear in the "Ignored" state../dspace database migrate ignored
on the database to upgrade to 7.x. You will receive errors for both the5.7.2017.04.11
or5.7.2017.05.05
migrations. Both of these migrations are no longer valid in 7.x, and are considered obsolete../dspace database skip [version]
command to skip each 5.7 migration:./dspace database info
again, verify that both of these migrations are now set to "Out Of Order" state (which means they are considered successfully run, but run out of numerical order)./dspace database migrate ignored
. This time, it will succeed.I've tested this entire scenario using the example database above. I've verified it allows users to get past these failing, ignored migrations.