3 ms·
Show HN: Zero-downtime PostgreSQL migrations for Ruby on Rails
- Smotko 5y agoThis looks really cool, awesome job! We desperately need something like this at my day job, but unfortunately we use MySQL and Django.
- techdragon 5y agoWhile it hasn't been updated in a while, fundamentally https://github.com/pombredanne/django-zerodowntime https://github.com/pombredanne/django-zerodowntime would be a base for building similar check logic in a DB agnostic way on Django. It has some of the most important checks in place, but could obviously do with adding more sophisticated checks. For Django users using PostgreSQL you can use https://github.com/antonioIrizar/django-check-migration-wtf https://github.com/antonioIrizar/django-check-migration-wtf or https://github.com/yandex/zero-downtime-migrations https://github.com/yandex/zero-downtime-migrations or https://github.com/tbicr/django-pg-zero-downtime-migrations https://github.com/tbicr/django-pg-zero-downtime-migrations to provide similar functionality to the library this post links to, depending on your exact use case of course.
- ghiculescu 5y agoThis is cool. We use strong_migrations but I’ll check this out. I love the idea of an enforced pattern for background data migrations. While I’m here a shameless plug for a gem we built that we’ve found incredibly helpful for safer migrations - https://github.com/TandaHQ/migration_signature https://github.com/TandaHQ/migration_signature It adds a CI check to guarantee the migrations you tested in development are actually the migrations that run in production.
- mnbbrown 5y agoWe have something similar https://github.com/gocardless/nandi https://github.com/gocardless/nandi It does signature checking and some and some other helpful things.
- mt42or 5y agoAlready existing gem works for both MySQL and PostgreSQL https://github.com/ankane/strong_migrations https://github.com/ankane/strong_migrations
- fatkodima 5y agoThanks for mentioning. I made a comparison with it - https://github.com/fatkodima/online_migrations#cool-but-there-is-a-strong_migrations-already https://github.com/fatkodima/online_migrations#cool-but-ther...
- xdxfw 5y agoTake a look at https://github.com/doctolib/safe-pg-migrations https://github.com/doctolib/safe-pg-migrations
- fatkodima 5y agoThanks for mentioning. Nice logo! I have seen that and borrowed verbose sql logging. Nice gem, I see the differences. My gem: 1. has more checks 2. has more migration helpers (renaming tables/columns, changing columns types, backfilling etc) 3. more flexible in terms of configuration 4. has background data migrations 5. does not disables wrapping migrations in a transaction, which can be inconvenient and dangerous
- shayonj 5y agoThis is very cool! I no longer work on Rails on daily basis, but would have loved to have this. I built something similar called `pg-osc` / `pg-online-schema-change` for PostgreSQL workloads. It does zero downtime migrations using triggers and shadow table. Github: https://github.com/shayonj/pg-osc https://github.com/shayonj/pg-osc. Blog: https://www.shayon.dev/post/2022/47/pg-osc-zero-downtime-schema-changes-in-postgresql/ https://www.shayon.dev/post/2022/47/pg-osc-zero-downtime-sch... Also love that this is written in Ruby :). Going to check it out on some side projects.