require-timeout-settings
problem
You must configure a lock_timeout
to safely apply migrations. See "Safety requirements"
Additionally, a statement_timeout also helps prevent long migrations that consume too many database resources.
solution
Configure both timeout settings at the beginning of your migration file:
-- error, missing timeouts
alter table t add column c boolean;
-- ok, timeouts configured before ddl operations
set lock_timeout = '1s';
set statement_timeout = '5s';
alter table t add column c boolean;
alternatively
If you're database connection is already configured with lock and statement timeouts, you can safely ignore this rule.