AshPostgres migrations vs Ecto

I deployed an app to and it just ran the migrations for me probably using the Ecto migrator before I could thing to switch over to AshPostgres for migrations.

I know I need to go in and edit the script that does migrations to use AshPostgres migrator instead, but I’m curious what the difference is between the two and what would happen if I allowed that first migration with Ecto, but started do in the rest with AshPostgres?


Just thought of one difference, Ecto isn’t going to take care of tenants if those are being used.

Also, look like support for enums as defined in AshResources

I found the guide on this, it gives a sample file for App.Release:

Since I’m not using tenants with this particular application I can ignore those differences, but I see this diff:


  defp repos do
    Application.fetch_env!(@app, :ecto_repos)

Ash HQ Example:

  defp repos do
    |> Enum.flat_map(fn api ->
      |> Ash.Api.Info.resources()
    |> Enum.uniq()

It looks like what the Ash HQ example is doing is dynamically finding/transforming all of the Repos defined within the projects Resources. So, I’m assuming since I have the simple setup of just one Repo that my first migration was essentially the same as this one would be since the default migrate function is the same as the AshHQ example except for how it retrieves the Repos.

1 Like