defmodule Marketplace.ApRepo do
use AshPostgres.Repo, otp_app: :marketplace
end
lib/application.ex
defmodule Marketplace.Application do
def start(_, _) do
children = [
...
ApRepo
]
...
end
end
Then I added one resource to it and generated the migration.
A new migration file was correctly added to the priv/ap_repo/migrations directory.
But, when I ran the mix ash_postgres.migrate, the migration process applied all the migrations I have in my original Repo to the ApRepo and not only that new resource I created.
I did notice this warning from the documentation:
This is only really useful if your api or apis only use a single repo. If you
have multiple repos and you want to run a single migration and/or migrate/roll
them back to different points, you will need to use the ecto specific task, mix
ecto.migrate and provide your repo name.
So, does this means that I need to start using ecto.migrate from now on or only if more than one repo uses the same api?
that sounds like a bug. You should be able to use that task with multiple repos, the main drawback is if you want to only migrate a specific repo. We can probably make our task support a --repo option if it doesn’t already.
So yeah if we’re actually applying migrations from both repos to one repo that is a bug somewhere. An example project showing this happening would be really useful. I’ve had multiple repos set up in an application and not seen that issue before.