Tell Ecto 3 which mix.exs to use for aliases in umbrella app

Any ideas how to tell ecto which app to run migrations from?

I had a two-app umbrella app, I added a new app called :db which I mean to manage for ecto postgrex database access. After moving all the schema files, database migration files, release_tasks.ex, priv/repo/migration dir to the new db umbrella app, ecto still checks the original apps mix.exs for the aliases which I presume tell ecto where to find directories. I moved the aliases to the db mix.exs because I want it to do the migrations now. Anyway here is the error log, any ideas?

•100% ➜ mix ecto.drop; mix ecto.create ; mix ecto.migrate
warning: function aliases/0 is unused
  /Users/michael/src/phx/fulword-phx/apps/db/mix.exs:61

Error while loading project :ful_word at /Users/michael/src/phx/fulword-phx/apps/ful_word
** (CompileError) apps/ful_word/mix.exs:17: undefined function aliases/0
    (stdlib) lists.erl:1338: :lists.foreach/2
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
warning: function aliases/0 is unused
  /Users/michael/src/phx/fulword-phx/apps/db/mix.exs:61

Error while loading project :ful_word at /Users/michael/src/phx/fulword-phx/apps/ful_word
** (CompileError) apps/ful_word/mix.exs:17: undefined function aliases/0
    (stdlib) lists.erl:1338: :lists.foreach/2
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
warning: function aliases/0 is unused
  /Users/michael/src/phx/fulword-phx/apps/db/mix.exs:61

Error while loading project :ful_word at /Users/michael/src/phx/fulword-phx/apps/ful_word
** (CompileError) apps/ful_word/mix.exs:17: undefined function aliases/0
    (stdlib) lists.erl:1338: :lists.foreach/2
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6

Looks like you moved the aliases function but not the call to it.

https://hexdocs.pm/mix/Mix.html#module-aliases

2 Likes

Of course! Thanks that did it. I was obviously coding too late.

2 Likes