rails-safe-migrations

v1.4 · edited · main
---
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.
↑↓ move↵ run⌘↵ ask Pilot