ankane/strong_migrations
71.7
Strong · 26 September 2026
1.8k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
Strong Migrations is a Ruby gem that enforces safe database migration practices by analyzing schema changes against PostgreSQL, MySQL, and MariaDB. It provides a modular, safe-by-default system that automatically executes non-blocking operations, manages lock and statement timeouts with retry logic, and offers granular configuration for specific database adapters. The library ensures migration safety through comprehensive checks for constraints, indexes, and column changes, while supporting modern Ruby and Active Record versions.
Features
Added alphabetize\_schema option
A new \strong\_migrations:alphabetize\_columns\ rake task has been added, which sets the \StrongMigrations.alphabetize\_schema\ configuration to \true\ to ensure schema columns are sorted alphabetically.
lib/tasks · high confidence
Added install generator for Strong Migrations configuration
Users can now run the Strong Migrations install generator to automatically create a configuration initializer at config/initializers/strong\_migrations.rb. The generated file includes a target\_version setting that defaults to 8.4 for MySQL/MariaDB/Trilogy adapters and 18 for PostgreSQL, along with a comment advising users to adjust timeouts if they use PgBouncer in transaction mode.
_lib/generators/strong\migrations · high confidence
New initializer template with safe-by-default and target version options
The strong\_migrations generator now includes a new initializer template that configures default settings such as lock and statement timeouts, automatic table analysis, and a commented-out target version setting to ensure development checks match production. It also introduces options for PostgreSQL users to enable safe-by-default behavior and automatic removal of invalid indexes, providing a more robust out-of-the-box configuration for migration safety.
_lib/generators/strong\migrations/templates · high confidence
Behavioural changes
Restructured database adapter logic and enforced minimum version requirements
The library has refactored its database-specific logic into a dedicated adapter hierarchy (AbstractAdapter, PostgreSQLAdapter, MySQLAdapter, MariaDBAdapter) to improve maintainability and accuracy. This change enforces stricter minimum version requirements, dropping support for PostgreSQL versions prior to 12, MySQL prior to 8.0, and MariaDB prior to 10.5. It also introduces support for PostgreSQL 17's transaction\_timeout setting, adds specific safety checks for MariaDB 11.4 charset handling, and corrects deprecation warnings with Active Record 7.1.
_lib/strong\migrations/adapters · high confidence
Restructured library loading and added configuration options
The library's internal structure has been refactored to replace direct ActiveRecord dependencies with ActiveSupport and introduce a modular adapter system (Abstract, MySQL, MariaDB, PostgreSQL). This change introduces numerous new configuration options for users, including \auto\_analyze\, \start\_after\, \lock\_timeout\, \statement\_timeout\, \safe\_by\_default\, \alphabetize\_schema\, and \skipped\_databases\. Additionally, the library now supports RACK\_ENV for environment detection and allows users to enable or disable specific checks via \enable\_check\ and \disable\_check\ methods.
lib · high confidence
Strong Migrations v2.8.0: Complete rewrite with safe-by-default checks and retry logic
Strong Migrations has been rewritten from the ground up (version 0.1.0 to 2.8.0) to provide a more robust and user-friendly migration safety experience. The core behavior now supports a \safe\_by\_default\ mode that automatically executes safe operations (like adding indexes or foreign keys) using non-blocking, concurrent algorithms, removing the need for manual \safety\_assured\ blocks in many common cases. The library now includes built-in retry logic for lock timeouts, configurable statement and lock timeouts, and an \auto\_analyze\ feature to maintain query performance after index creation. It also introduces new checks for complex operations like adding check constraints, exclusion constraints, and handling callable default values, while dropping support for older Ruby and Active Record versions.
_lib/strong\migrations · high confidence
Test coverage
Added test support files for ActiveRecord setup and helper methods; Comprehensive test suite for migration safety checks; Expanded test coverage for migration safety checks.
Dependencies
Added CI support for Active Record 7.2, 8.0, and 8.2
The gemfiles directory now includes dedicated configuration files for testing against Active Record 7.2, 8.0, and 8.2 (alpha). These new gemfiles ensure compatibility with these specific versions of Active Record, along with their respective database adapters (PostgreSQL, MySQL, Trilogy, and SQLite3), allowing the library to be tested against these newer versions of the framework.
gemfiles · high confidence
Drops support for Ruby \< 3.3 and Active Record \< 7.2, adds Trilogy support
The gem now requires Ruby 3.3 or higher and Active Record 7.2 or higher, removing support for older versions. Development dependencies have been moved from the gemspec to the Gemfile, and the gem now explicitly includes support for the Trilogy MySQL driver alongside existing PostgreSQL, MySQL2, and SQLite3 drivers.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 51 → 72 (+21.1)
- Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 97 → 91 (-6.3)
- Architecture 94 → 88 (-6.2)
- Maturity 63 → 63 (+0.0)
- Readiness 26 → 67 (+41.4)
- Security 71 → 100 (+29.0)
Resolved (10)
- Coverage not measured — test suite did not build
- Dimension evaluation failed
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- No exposed public API
- No tests found
- Test reliability not included
New (33)
- Ambiguous method naming. perform and perform_method are semantically very similar. It is unclear if perform_method is a simplified wrapper or if they handle different execution contexts (e.g., transaction handling).
- Checker.perform (cyclomatic 32) (lib/strong_migrations/checker.rb)
- Checks.check_add_column (cognitive 21) (lib/strong_migrations/checks.rb)
- Checks.check_add_column (cyclomatic 18) (lib/strong_migrations/checks.rb)
- Checks.check_add_reference (cognitive 48) (lib/strong_migrations/checks.rb)
- Checks.check_add_reference (cyclomatic 26) (lib/strong_migrations/checks.rb)
- Checks.check_change_column_null (cognitive 29) (lib/strong_migrations/checks.rb)
- Documentation: no project overview (README.md)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Inconsistent version configuration strategy. target_version is a generic property, but specific database versions are exposed as separate properties. This suggests target_version might be ignored or overridden by the specific ones, or vice versa, creating ambiguity in precedence.
- No dependency advisory monitoring
- PostgreSQLAdapter.change_type_safe? (cognitive 38) (lib/strong_migrations/adapters/postgresql_adapter.rb)
- PostgreSQLAdapter.change_type_safe? (cyclomatic 45) (lib/strong_migrations/adapters/postgresql_adapter.rb)
- Redundant configuration entry points. start_after is exposed as a global property on the main module and also as a method on the InstallGenerator. While one is for runtime config and one is for generator output, the naming collision creates confusion about where the configuration lives.
- TodoComment (lib/strong_migrations/adapters/postgresql_adapter.rb)
- TodoComment (lib/strong_migrations/adapters/postgresql_adapter.rb)
- …and 13 more
Changes since last survey
- 4 commits — 2 feature/other, 2 fixes
By area
- lib/strong_migrations — 2 commits
- (root) — 1 commit
- .github/workflows — 1 commit
Notable commits
- fix: Fixed UTC check for Active Record 8.2
- fix: Fixed alphabetize_schema option for Active Record 8.2 - resolves #322 [skip ci]
- change: Updated checkout action [skip ci]
- change: Updated readme [skip ci]
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ankane/strong_migrations was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 26 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 23d8e1f7d7aad502388a5dfcf49affa3b0cfb086 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-7c1cb6328e11.