feat: introduce advisory lock mode#1648
Conversation
661d7a5 to
f99ec39
Compare
|
basic shape of the PR looks already mergable 👍 however I would like to make an in-depth review with claude from home this evening my current gut feeling: are |
take your time :) |
f99ec39 to
669c99b
Compare
|
@Shinigami92 i have also added Troubleshooting explanation |
Shinigami92
left a comment
There was a problem hiding this comment.
Claude Opus 4.8 is fine with wait/fail 🙁
669c99b to
3cf2cc7
Compare
|
@Shinigami92 how can i fix the lint issue? in the bin/node-pg-migrate.ts you use type from the node-pg-migrate package, and this augmented type is not published yet |
this is something we will fix in v10 |
2035ee6 to
711d1e9
Compare
|
@nemisj You can see the errors also in the job runs |
af55716 to
f095aed
Compare
Shinigami92
left a comment
There was a problem hiding this comment.
if it gets too much for you, say a word and I can take over when I find the time
f095aed to
50c557e
Compare
|
@Shinigami92 do you think it takes long for others to review? i would love to use this feature as soon as possible 😇, since currently i'm patching the node-pg-migrate on our end |
You can expect to work with it in upcoming week |
Great. thanks :) |
This PR introduces a new
advisoryLockModeoption for migration locking.Current behavior uses
pg_try_advisory_lock, which fails immediately when another migration process already holds the advisory lock. While this behavior is preserved as the default ('fail') for backward compatibility, users can now opt into'wait'mode, which usespg_advisory_lockand waits until the lock becomes available.This is particularly useful in deployment environments where multiple application instances may attempt to run migrations concurrently and should be serialized rather than fail.
Available modes:
fail(default): Fail immediately if the advisory lock is already held.wait: Wait until the advisory lock becomes available.ref: #1647