A postgresql datalayer for the Ash Framework
Find a file
2021-11-24 19:34:58 -05: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 fix: better embedded filters, switch to latest ash 2021-02-24 13:59:49 -05:00
documentation improvement: update to latest ash 2021-05-14 01:20:10 -04:00
lib improvement: don't upsert defaults on conflict (#77) 2021-11-24 19:31:59 -05:00
logos feat: use the new DSL builder for config (#7) 2020-06-14 03:04:18 -04:00
priv fix: handle new if types 2021-11-13 14:48:14 -05:00
test fix: handle new if types 2021-11-13 14:48:14 -05:00
test_snapshot_path chore: work on tests 2021-11-13 13:57:00 -05:00
.check.exs chore: only run coverage once (#14) 2020-08-27 23:00:57 -04:00
.credo.exs chore: fix lint 2021-07-05 14:24:41 -04:00
.formatter.exs improvement: add custom migration types, and repo level override 2021-11-10 04:18:36 -05:00
.gitignore feat: snapshot-based migration generator 2020-09-10 20:26:47 -04:00
CHANGELOG.md chore: release version v0.41.3 2021-11-13 14:48:47 -05:00
LICENSE Update LICENSE 2020-09-21 14:02:15 -04:00
mix.exs chore: update version requirement to allow 1.51+ 2021-11-24 19:34:58 -05:00
mix.lock improvement: don't upsert defaults on conflict (#77) 2021-11-24 19:31:59 -05:00
README.md docs: Update docs in readme (#50) 2021-03-14 17:22:59 -04:00

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