# ankane/strong_migrations

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ankane-strong-migrations).**

_How this analysis was created: the description and tags below were written by an AI model that read this project's README and public documentation pages; stars, license and language come straight from the GitHub API. The model does not read the source code._

4,411 stars · 196 forks · Ruby · MIT

## Links

- GitHub: https://github.com/ankane/strong_migrations
- awesome-repositories: https://awesome-repositories.com/repository/ankane-strong-migrations.md

## Description

Strong Migrations is a PostgreSQL migration safety tool designed to prevent production downtime by detecting and blocking risky schema changes. It serves as a schema validator that identifies dangerous database operations and suggests safe alternatives to ensure zero-downtime deployments.

The project distinguishes itself by acting as a database lock manager and index optimizer. It manages statement timeouts and implements automatic retry logic for lock timeouts to prevent database congestion. Additionally, it provides utilities to clean up invalid concurrent indexes and update table statistics after schema changes to maintain query planner performance.

The tool covers a broad range of database management capabilities, including safety validation with customizable rules, automated migration patterns, and structural schema organization such as column alphabetization. It uses version-aware validation to align safety checks with the specific capabilities of the target database engine.

## Tags

### Data & Databases

- [PostgreSQL Schema Migrations](https://awesome-repositories.com/f/data-databases/schema-migration-tools/postgresql-schema-migrations.md) — Detects and blocks risky schema changes in PostgreSQL to ensure zero-downtime deployments.
- [Schema Migration Validation](https://awesome-repositories.com/f/data-databases/schema-migrations/schema-migration-validation.md) — Identifies risky database operations and suggests safe patterns to prevent production downtime. ([source](https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations/error_messages.rb))
- [Safe Pattern Automation](https://awesome-repositories.com/f/data-databases/automated-migrations/safe-pattern-automation.md) — Automatically executes dangerous operations using safe alternatives without requiring changes to the original migration code. ([source](https://github.com/ankane/strong_migrations#readme))
- [Database Lock Mitigation](https://awesome-repositories.com/f/data-databases/database-lock-mitigation.md) — Prevents migrations from blocking application traffic by managing statement timeouts and retry logic.
- [Database Migration Safety](https://awesome-repositories.com/f/data-databases/database-migration-safety.md) — Identifies dangerous operations during development to ensure safe execution patterns before production.
- [Zero-Downtime Schema Migrations](https://awesome-repositories.com/f/data-databases/database-type-support/database-engine-migrations/postgresql-to-postgresql-migrations/zero-downtime-schema-migrations.md) — Prevents production outages by detecting and blocking risky schema changes that could lock tables.
- [Lock and Statement Timeout Management](https://awesome-repositories.com/f/data-databases/migration-configurations/lock-and-statement-timeout-management.md) — Sets lock and statement timeouts to prevent migrations from blocking active database operations. ([source](https://github.com/ankane/strong_migrations#readme))
- [Migration Lock Managers](https://awesome-repositories.com/f/data-databases/migration-lock-managers.md) — Implements statement timeouts and automatic retry logic for lock timeouts to prevent database congestion during migrations.
- [Migration Safety Validators](https://awesome-repositories.com/f/data-databases/schema-migration-tools/postgresql-schema-migrations/migration-safety-validators.md) — Identifies risky SQL patterns and suggests safe alternatives to prevent production downtime during deployments.
- [Table Performance Optimizers](https://awesome-repositories.com/f/data-databases/data-management/table-data-managers/table-lifecycle-automators/table-performance-optimizers.md) — Updates database statistics after schema changes to maintain consistent query performance and planning. ([source](https://github.com/ankane/strong_migrations/blob/master/CHANGELOG.md))
- [Target Version Configuration](https://awesome-repositories.com/f/data-databases/database-versioning/database-version-inspectors/target-version-configuration.md) — Allows specifying target database versions to align safety checks with engine capabilities. ([source](https://github.com/ankane/strong_migrations/blob/master/CHANGELOG.md))
- [Version-Aware Validation](https://awesome-repositories.com/f/data-databases/database-versioning/version-aware-validation.md) — Matches migration patterns against a registry of safe features specific to the target database engine version.
- [Post-Migration Statistics Refresh](https://awesome-repositories.com/f/data-databases/statistical-analysis-tools/post-migration-statistics-refresh.md) — Triggers database analyze commands after index creation to maintain optimal query planner performance.
- [Concurrent Index Cleanup](https://awesome-repositories.com/f/data-databases/table-indexing-systems/database-indexes/concurrent-indexing/concurrent-index-cleanup.md) — Provides utilities to clean up invalid concurrent indexes and update table statistics after schema changes.
- [Invalid Index Cleanup](https://awesome-repositories.com/f/data-databases/table-indexing-systems/database-indexes/concurrent-indexing/invalid-index-cleanup.md) — Removes invalid indexes created by failed concurrent index additions before retrying the migration. ([source](https://github.com/ankane/strong_migrations#readme))

### Security & Cryptography

- [Lock Timeout Retries](https://awesome-repositories.com/f/security-cryptography/session-timeout-configurations/idle-session-timeouts/server-idle-timeout-configurations/read-operation-timeouts/lock-timeout-retries.md) — Automatically retries migration statements that fail due to database lock timeouts to prevent deployment failure.

### Software Engineering & Architecture

- [Automatic Task Retries](https://awesome-repositories.com/f/software-engineering-architecture/task-retry-policies/manual-task-retries/automatic-task-retries.md) — Automatically re-executes migration statements when they encounter database lock timeouts. ([source](https://github.com/ankane/strong_migrations/blob/master/README.md))
- [Method Interception Proxies](https://awesome-repositories.com/f/software-engineering-architecture/method-interception-proxies.md) — Wraps standard database migration methods to inject safety checks and safe-pattern replacements at runtime.

### Testing & Quality Assurance

- [Static Analysis AST Parsing](https://awesome-repositories.com/f/testing-quality-assurance/static-code-analysis/ast-extraction/static-analysis-ast-parsing.md) — Uses abstract syntax tree parsing to identify dangerous database operations in migration source code before execution.
