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?
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With