Skip to content

MG27 — Lock-taking migration without statement/lock timeout

Group: Migration safety · Auto-fixable: no

A migration that takes a heavy lock (ALTER TABLE, CREATE INDEX) without a prior SET statement_timeout / SET lock_timeout can block all traffic indefinitely while it waits behind a long-running query. Set a lock_timeout first.

bad: ALTER TABLE t ADD COLUMN c int;
good: SET lock_timeout = '5s'; ALTER TABLE t ADD COLUMN c int;

Disable this rule in banshee.toml:

[lint]
exclude = ["MG27"]

Or silence one line with -- noqa: MG27. See Linting.