I'm building a project, which is going to act as a core for multiple other projects, somewhat like a Rails Engine in ruby world.
I have implemented some base database structure in my core project, basically structure that is shared across the board.
My problem is that my projects, that uses my core, doesn't register the migrations of the core project.
Is there any way i can run migrations of my core dependency?
Let me know if you need more information. :-)
Thank you
You should be able to use the Ecto.Migrator
module in a custom task.
See running-migration-in-an-exrm-release for a more detailed explanation.
defmodule Release.Tasks do
def migrate do
{:ok, _} = Application.ensure_all_started(:my_dependency)
path = Application.app_dir(:my_dependency, "priv/repo/migrations")
Ecto.Migrator.run(MyApp.Repo, path, :up, all: true)
:init.stop()
end
end