feat: add strong_migrations gem to prevent unsafe migration deploys - #2774
Open
mroderick wants to merge 1 commit into
Open
feat: add strong_migrations gem to prevent unsafe migration deploys#2774mroderick wants to merge 1 commit into
mroderick wants to merge 1 commit into
Conversation
mroderick
force-pushed
the
feature/strong-migrations
branch
from
August 1, 2026 06:53
e02352b to
21b1648
Compare
…oduction Install strong_migrations 2.8.0 and configure it to analyze all migrations from 2026-01-01 onwards. Target PostgreSQL 16 (Heroku production version). Wrap existing 2026 migrations that violate safety rules with `safety_assured` blocks — these were already deployed and are acknowledged as reviewed. No migration logic is changed. Violations wrapped: - execute SQL with DELETE (duplicate cleanup) - update_all inside migration (sponsor backfill) - add_index without algorithm: :concurrently - remove_index without algorithm: :concurrently - drop_table (meeting_talks removal) - data cleanup loops inside schema migrations
mroderick
force-pushed
the
feature/strong-migrations
branch
from
August 1, 2026 06:56
21b1648 to
ad9b1eb
Compare
mroderick
marked this pull request as ready for review
August 1, 2026 07:10
Collaborator
Author
|
@olleolleolle do you think it makes sense to fix all the existing migrations, going all the way back to the dawn of time? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the strong_migrations gem to block dangerous migration patterns before they reach production.
Scope
start_after = 20260101000000)Existing violations acknowledged
Six 2026 migrations already deployed contain patterns strong_migrations flags. Each is wrapped in
safety_assured { ... }— no logic changes, just marking them as reviewed:executewith DELETE for duplicate cleanupupdate_allinside a schema migration for data backfilladd_indexwithoutalgorithm: :concurrentlyremove_indexwithoutalgorithm: :concurrentlydrop_tableonmeeting_talksdelete_all) inside schema migrationsReviewer hint: it's a lot easier to review this part of the PR, if you hide the whitespace changes 😄
What this prevents going forward
algorithm: :concurrentlyon large tablesdrop_table/remove_columnwithout a staged removal processexecuteSQL without review