DidactMacros

DidactMacros

Doesn't seem possible to drop a database while MIX_ENV=prod

This command seems to always fail

MIX_ENV=prod mix ecto.reset

The database for ContExp.Repo couldn't be dropped: ERROR 55006 (object_in_use) cannot drop the currently open database

I just tried this in the dev environment and it worked, I restarted the shell, and have no web pages running.

Is the production env itself keeping the db open in a way that prohibits dropping it?

It seems we are not supposed to drop dbs in prod, perhaps db configs are discarded between different product versions?

Would appreciate some light on this. I’ll also be reviewing the docs for clues.

EDIT: MIX_ENV=prod mix ecto.drop --force-drop also yields the same connection error (despite being used for the sake of ignoring connections).

Most Liked

LostKobrakai

LostKobrakai

This is a postgres question not an ecto one. That error is postgres telling you that you cannot drop a db while other concurrent connections to the database exist. Stop those other connections and the drop should start working.

Though I’d argue that these kind of operations should generally not be done through mix commands in a production environment. Imo it’s better to use a limited user account with the application, preventing it doing any harmful operations on accident. One off tasks like deletion of a db then happen on the side using some admin credentials independently from the application.

Last Post!

DidactMacros

DidactMacros

I don’t know if this is the right way to do it but

MIX_EVN=prod mix ecto.rollback --all

…is a quite sufficient compromise for me (perhaps not even a compromise at all)

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement