docker-compose rails rake db:reset fails, “cannot drop the currently open database”

前端 未结 1 1472
逝去的感伤
逝去的感伤 2021-01-13 02:50

I can\'t seem to reset my database while using docker compose. I\'ve tried killing the server, killing just the database, and restarting the machine.

Anyone know the

1条回答
  •  感情败类
    2021-01-13 03:24

    You are using the wrong database.

    The database postgres is normally not used for user data, but for administrative purposes. For example, if you want to drop a database, you have to be connected to a different database in the PostgreSQL database cluster to issue the SQL statement DROP DATABASE. Normally, the database postgres is used for that purpose, and I have no doubt that Docker does exactly that when it tries to drop a database.

    If you really want to drop the database postgres, you'd have to connect to some other database in the cluster. The correct solution, however, is to keep your data in a different database. Then the problem should go away by itself.

    0 讨论(0)
提交回复
热议问题