1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
name: rails-safe-migrations
description: Check new migrations for table locks before release.
tools: [postgres.inspect_locks, github.create_pull_request]
triggers: [deploy.release_started, pr.opened]
---
## Rules
- add_index on tables over 1M rows → algorithm: :concurrently
- concurrently → disable_ddl_transaction!
- change_column_null → add check constraint first
- set lock_timeout 5s on every release
## When a rule fails
1. Block the release.
2. Draft the rewrite as a PR.
3. Ask the author to approve.