Skip to content

Grab an advisory lock for migration as per Heroku recommendations #23

@brabster

Description

@brabster

Hi there,

I saw some advice on https://devcenter.heroku.com/articles/release-phase#design-considerations that suggests grabbing an "advisory lock" on the database before running a migration.

Basically, try SELECT pg_try_advisory_lock(migration); at the start of the transaction.

  • It if returns t then nothing currently has the lock, called 'migration', so proceed.
  • If not, fail the migration.
    The lock will be release when the transaction commits or rolls back.

I think that would be a one-line change in this module. Good idea?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions