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 an 'ignorePendingMigrations' configuration option #2128

Closed
yjo opened this issue Aug 31, 2018 · 5 comments
Closed

Add an 'ignorePendingMigrations' configuration option #2128

yjo opened this issue Aug 31, 2018 · 5 comments

Comments

@yjo
Copy link
Contributor

@yjo yjo commented Aug 31, 2018

Add an 'ignorePendingMigrations' option to suppress validation errors caused by the availability of not-yet-applied migrations.

My use case is for a CI/CD pipeline - while developers are working on a feature branch they should be able to create and modify migrations for that feature. However, we should be able to detect and break the build when changes are made to versioned migrations that have already been applied to (e.g.) our production database. Running flyway validate with ignorePendingMigrations=true would support this scenario and be consistent with the existing ignore*Migrations options.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Aug 31, 2018

This is already possible by passing -target=current to the flyway validate command.

@yjo
Copy link
Contributor Author

@yjo yjo commented Sep 3, 2018

@axelfontaine -target=current doesn't seem to work in exactly the same way in the presence of out-of-order migrations. E.g. if I run flyway -target=current -ignoreIgnoredMigrations=true -ignoreFutureMigrations=true -outOfOrder=true validate then I can still get "Detected resolved migration not applied" errors. This happens when running with a migration set with a new migration ordered before the current DB version, which can occur when team members work on feature branches that overlap in time. When running with the proposed ignorePendingMigrations=true option the validation works as expected.

@yjo
Copy link
Contributor Author

@yjo yjo commented Sep 3, 2018

Hmm, the right configuration for my use case seems to be to use -ignoreIgnoredMigrations=true -outOfOrder=false which isn't super intuitive. I think one source of difficulty is that the documentation mostly assumes a very linear, serialised version history (corresponding to application release versions), and its examples don't often apply to scenarios where a team creates migrations in a distributed, parallel way (as application features are developed).

@yjo
Copy link
Contributor Author

@yjo yjo commented Sep 3, 2018

Versioned migrations aside, I can't find any combination of existing flags that will pass validation with changes to a repeatable migration. It seems that might only be achievable with an ignorePendingMigrations option, @axelfontaine?

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Sep 3, 2018

@yjo Thanks for the clarifications. I am starting to warm to the idea of adding this. Reopening.

@axelfontaine axelfontaine reopened this Sep 3, 2018
@axelfontaine axelfontaine added this to the Flyway 5.2.0 milestone Sep 3, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Sep 19, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.