I'm no longer able to rake db:drop since I upgraded from Rails 4.2 to Rails 5.1.4.
I get the following error message whenever I try to run the task:
PG::ObjectInUse: ERROR: database "myapp_development" is being
accessed by other users
DETAIL: There is 1 other session using the database.
: DROP DATABASE IF EXISTS "myapp_development"
Couldn't drop database 'myapp_development'
rails aborted!
ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database
"myapp_development" is being accessed by other users
DETAIL: There is 1 other session using the database.
: DROP DATABASE IF EXISTS "myapp_development"
I used to make it work with this hack:
Rails + Postgres drop error: database is being accessed by other users
Now, when I integrate this solution into my application, I get another error message:
FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Couldn't drop database 'myapp_development'
rails aborted!
PG::AdminShutdown: FATAL: terminating connection due to
administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Do you guys have a fix for this issue?
Btw, I'm running Postgres 9.6, ruby 2.4.2 and Rails 5.1.4.