How to make ecto migration aware of module name?

I am running on multiple repos on single otp app, it used to be separated into two app.
The problem is, when I run migration, it runs on both repos, because ecto migrate everything under priv/
I was aware about -r and :ecto_repos config, not putting one of the repo inside that config solves the problem.

But that’s not what I want, it will be better if ecto migration aware of module name or folder pattern to run migrations on that exact repo. Is there anyway to achieve that?

1 Like

You can configure the migration path for each repo (described in the options in here):

config :my_app, MyApp.Repo,
  priv: "priv/foo_bar_baz"

In that case ecto will look for migrations for that repo in priv/foo_bar_baz/migrations.

3 Likes

Owh… that I wasn’t aware :slight_smile: