Skip to content

Skip advisory lock when already at target version#142

Open
vadim2404 wants to merge 1 commit intojackc:masterfrom
vadim2404:fast-path-skip-lock-when-at-target
Open

Skip advisory lock when already at target version#142
vadim2404 wants to merge 1 commit intojackc:masterfrom
vadim2404:fast-path-skip-lock-when-at-target

Conversation

@vadim2404
Copy link
Copy Markdown

Adds a fast path to MigrateTo that returns early when the database is already at the target version, avoiding contention on the migrations advisory lock for schema-stable deploys (a common case in CI/CD where every deploy runs the migrator regardless of whether new migrations were added).

Conservative by design: out-of-range versions and any GetCurrentVersion error fall through to the locked path, so error semantics are unchanged.

Adds a fast path to MigrateTo that returns early when the database is
already at the target version, avoiding contention on the migrations
advisory lock for schema-stable deploys (a common case in CI/CD where
every deploy runs the migrator regardless of whether new migrations
were added).

Conservative by design: out-of-range versions and any GetCurrentVersion
error fall through to the locked path, so error semantics are unchanged.
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.

1 participant