No commit activity in last 3 years
No release in over 3 years
Runs Rails migrations in a Redis-backed mutex.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Rails db:migrate:mutex

Circle CI

Runs Rails migrations in a Redis-backed mutex.

If you deploy your application to multiple servers and do not use a deployment tool like Capistrano, this gems makes sure that only one of your servers run the database migrations.

Running Rails migrations on multiple instance at the same time should not cause any real trouble, because they are run inside transactions, but can cause excessive DB load and Ruby exceptions.

Usage

Run rake db:migrate:mutex instead of rake db:migrate to ensure that the migrations are only run on one server at the same time.

Installation

Add the gem to your Gemfile:

gem 'rails_migrate_mutex'

If Redis.current does not contain a valid Redis connection, you might need to set it manually:

# config/initializers/redis_classy.rb
RedisClassy.redis = Redis.new(...)

Contributing

Feel free to fork and submit pull requests!

License

MIT, see LICENSE.txt.