Elixir CI License: MIT Coverage Status Hex version badge

AshPostgres supports all capabilities of an Ash data layer, and it will most likely stay that way, as postgres is the primary target/most maintained data layer.

Custom Predicates:

  • AshPostgres.Predicates.Trigram


See the DSL documentation in AshPostgres.DataLayer for DSL documentation


First, ensure you've added ash_postgres to your mix.exs file.

{:ash_postgres, "~> x.y.z"}

To use this data layer, you need to chage your Ecto Repo's from use Ecto.Repo, to use AshPostgres.Repo. because AshPostgres adds functionality to Ecto Repos.

Then, configure each of your Ash.Resource resources by adding use Ash.Resource, data_layer: AshPostgres.DataLayer like so:

defmodule MyApp.SomeResource do
  use Ash.Resource, data_layer: AshPostgres.DataLayer

  postgres do
    repo MyApp.Repo
    table "table_name"

  attributes do
    # ... Attribute definitions

Generating Migrations

See the documentation for Mix.Tasks.AshPostgres.GenerateMigrations for how to generate migrations from your resources