A Ruby gem for performing online MySQL schema migrations without locking tables, enabling agile database evolution at scale.
Large Hadron Migrator (Lhm) is a Ruby gem that enables online MySQL schema migrations without locking tables, allowing databases to evolve while remaining fully operational. It solves the problem of prolonged downtime when altering large tables by using a copy table and triggers to synchronize data changes during migration. This is particularly valuable for applications with tables containing millions of records where traditional ALTER TABLE operations would cause significant disruption.
Rails developers and database administrators working with large MySQL databases who need to perform schema changes without causing downtime. It is especially relevant for teams managing high-traffic applications where availability is critical.
Developers choose Lhm because it provides a robust, trigger-based solution for zero-downtime migrations that integrates seamlessly with ActiveRecord. Unlike some alternatives, it does not require an indexed updated_at column and offers flexible throttling and filtering options to handle large datasets safely and efficiently.
Online MySQL schema migrations
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Executes schema changes without locking tables, preventing site downtime even for large tables with millions of records, as emphasized in its philosophy.
Uses a copy table and database triggers to maintain data consistency between old and new tables during migration, ensuring integrity.
Includes throttlers like time-based or slave-lag-aware options to control data copy pace, reducing replication lag and operational impact.
Employs atomic RENAME TABLE operations for seamless switching, minimizing disruption, though it may require locked strategy for certain MySQL versions.
Supports conditional migrations with custom SQL joins or filters to limit copied data, adding flexibility for complex datasets.
Only works with MySQL databases and requires an established ActiveRecord connection, making it incompatible with other databases or ORMs.
Mandates a single auto-incremented integer primary key called 'id', limiting use for tables with composite or non-integer keys, as noted in limitations.
The chunker implementation can suffer performance issues when the id column has sparse values, affecting migration efficiency for certain data distributions.
Requires manual integration with ActiveRecord and cleanup of orphaned tables from interrupted migrations, adding operational overhead.