A postgresql datalayer for the Ash Framework
Find a file
2021-11-01 04:45:39 -04:00
.github chore: use latest ash version in CI 2021-09-20 16:47:24 -04:00
.vscode improvement!: update to latest ash/ecto versions w/ parameterized types 2021-09-13 12:58:23 -04:00
config
documentation
lib fix: use proper ecto types everywhere 2021-11-01 04:41:41 -04:00
logos
priv
test improvement: support default on aggregates 2021-10-25 18:53:34 -04:00
test_snapshot_path
.check.exs
.credo.exs
.formatter.exs improvement: support custom_indexes 2021-09-20 16:38:36 -04:00
.gitignore
CHANGELOG.md chore: release version v0.41.0-rc.9 2021-11-01 04:45:39 -04:00
LICENSE
mix.exs chore: release version v0.41.0-rc.9 2021-11-01 04:45:39 -04:00
mix.lock chore: update to latest ash 2021-11-01 04:45:27 -04:00
README.md

AshPostgres

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

DSL

See the DSL documentation in AshPostgres.DataLayer for DSL documentation

Usage

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"
  end

  attributes do
    # ... Attribute definitions
  end
end

Generating Migrations

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