Add options to migrator Validate functions + option for TargetVersion#1259
Open
brandur wants to merge 1 commit into
Open
Add options to migrator Validate functions + option for TargetVersion#1259brandur wants to merge 1 commit into
Validate functions + option for TargetVersion#1259brandur wants to merge 1 commit into
Conversation
…ion` This one in response to #1257. It's useful to validate the current state of the database's migrations, but you may not be fully on the latest version and could get an error. The included example is for Pro v0.24.0 which includes two migrations: one to be rolled out before deploy and one to be rolled out after. `Validate` would fail until the post-deploy migrations were run, which isn't flexible enough. Here, have `Validate` functions take a `ValidateOpts` similar to the `MigrateOpts` taken by the `Migrate` functions. `ValidateOpts` includes `TargetVersion`, which lets you specify a maximum version bound. Notably, this is a breaking change in that we add a new parameter to `Validate`. I'm a little on the fence about this, but doing it via breaking (1) avoids an extra pair of functions that pollute the API and need testing, (2) should be *mostly* low impact because I doubt all that many people are using `Validate`, and (3) the fix is super easy in that you just need to add a `nil` in the last parameter place if you don't want to use any new options. Fixes #1257.
68b5507 to
8a40c08
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This one in response to #1257. It's useful to validate the current state
of the database's migrations, but you may not be fully on the latest
version and could get an error. The included example is for Pro v0.24.0
which includes two migrations: one to be rolled out before deploy and
one to be rolled out after.
Validatewould fail until the post-deploymigrations were run, which isn't flexible enough.
Here, have
Validatefunctions take aValidateOptssimilar to theMigrateOptstaken by theMigratefunctions.ValidateOptsincludesTargetVersion, which lets you specify a maximum version bound.Notably, this is a breaking change in that we add a new parameter to
Validate. I'm a little on the fence about this, but doing it viabreaking (1) avoids an extra pair of functions that pollute the API and
need testing, (2) should be mostly low impact because I doubt all that
many people are using
Validate, and (3) the fix is super easy in thatyou just need to add a
nilin the last parameter place if you don'twant to use any new options.
Fixes #1257.