Skip to content

Add options to migrator Validate functions + option for TargetVersion#1259

Open
brandur wants to merge 1 commit into
masterfrom
brandur-validate-opts
Open

Add options to migrator Validate functions + option for TargetVersion#1259
brandur wants to merge 1 commit into
masterfrom
brandur-validate-opts

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented May 27, 2026

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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow specifying target version when validating migrations

1 participant