I have a problem. I have build an application in rails using docker. This application consists of 4 containers:
- Rails app
- Postgres DB
- Redis
- Sidekiq (Clone of rails app)
Now I want to reset my db in my rails app, but when I run:
docker-compose exec app rails db:migrate:reset
I get:
ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "my_app_development" is being accessed by other users
DETAIL: There are 4 other sessions using the database.
I saw this fix from someone, but this code results in:
kill: you need to specify whom to kill
I think because this is task will be executed in one container and it only looks for process within that container and not the other docker containers. My question is how I can reset my db without the other docker images to crash or anything, but temporary stop the database connections for them. I really need to be able to reset my database when I have to!
Please let me know!