Reputation: 16373
In a Ruby On Rails app I ran rails db:migrate
, and for some reason the migration hung. I ended up having to kill the terminal tab in which the migration was run. When I tried to run rails db:migrate
in a new tab, I received this error message:
Cannot run migrations because another migration process is currently running
How do I fix this?
Upvotes: 15
Views: 14038
Reputation: 1047
If you are using postgresql in linux based system, you can use below command to restart the database. Then run your migrations again.
/etc/init.d/postgresql restart
Upvotes: 12
Reputation: 16373
Stop and then restart the database again. Then try rails db:migrate
again.
If you are using posgresql installed with homebrew on Mac OSX the following stops/restarts the database:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl -D /usr/local/var/postgres stop -s -m fast
Upvotes: 9