-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mnesia dir changes based upon context in umbrella project #40
Comments
Hello, Thanks for a detailed feedback. Unfortunately adapter itself has nothing to do with Mnesia migrations (there we simply use Erlang implementation), however I'll try to look closer if we can fix it on our side. |
Just in case anyone else is having a similar issue and needs a workaround, use the following config for mnesia in your app's config :mnesia, dir: to_charlist Path.join(File.cwd!, "priv/data") It seems that mix tasks run relative to the path of the mix file. Consequently, this change will make it so running This workaround is far from ideal, since the behavior is different depending on where you run If you always (or usually) interact with your project from the root of the umbrella, this approach will get you over the hump until a more permanent solution is found, though. |
Hi, I'm using this workaround and it seems to do the same thing whether I'm in the umbrella root or the
|
Using Ecto 2.1.4, ecto_mnesia 0.9.0, and Elixir 19, there appears to be inconsistent behavior with respect to the path to mnesia's disc copies in umbrella projects.
During the execution of
ecto.create
andecto.migrate
, the mnesia files for the app under the umbrella are created relative to the app, as one might expect:However, when the umbrella project is run, mnesia appears to be looking at the configured path relative to the root of the umbrella project, not relative to the app:
You'll notice that it's looking for the mnesia files in
/priv/thingy/data
, not/apps/under_umbrella/priv/thingy/data
, and so things don't work. If you run theecto.create
andecto.migrate
commands with the aforementioned configuration, and then changeconfig.exs
to useapps/under_umbrella/priv/thingy/data
before runningiex
, things work as expected:However, I don't know if there is a way to change the configuration based on context, though I doubt this is intentional behavior. I've created a repo that demonstrates the issue for you here.
Please let me know if you need anything else.
The text was updated successfully, but these errors were encountered: