Skip to content

require-lock-timeout

DDL migration missing positive SET [LOCAL] lock_timeout or statement_timeout prior to DDL.

Why

Unbounded lock waits can stall production traffic indefinitely when migration DDL contends with active transactions.

Fix

Set a short positive lock_timeout or statement_timeout before the DDL statement.

Examples

Before — flagged DDL without a positive timeout
supabase/migrations/001_users.sql
ALTER TABLE users
ADD COLUMN note TEXT;
After — preferred DDL preceded by a positive lock timeout
supabase/migrations/001_users.sql
SET
lock_timeout = '3s';
ALTER TABLE users
ADD COLUMN note TEXT;