mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
A postgresql datalayer for the Ash Framework
7ab8ede626
Use Logger.warning instead of Logger.warn, which is deprecated |
||
---|---|---|
.github | ||
.vscode | ||
config | ||
documentation | ||
lib | ||
logos | ||
priv | ||
test | ||
test_snapshot_path | ||
.check.exs | ||
.credo.exs | ||
.formatter.exs | ||
.gitignore | ||
.tool-versions | ||
CHANGELOG.md | ||
LICENSE | ||
mix.exs | ||
mix.lock | ||
README.md |
AshPostgres
AshPostgres supports all the capabilities of an Ash data layer. AshPostgres is the primary Ash data layer.
Custom Predicates:
AshPostgres.Predicates.Trigram
DSL
See the DSL documentation in AshPostgres.DataLayer
for DSL documentation
Usage
Add ash_postgres
to your mix.exs
file.
{:ash_postgres, "~> 1.3.6"}
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
Contributors
Ash is made possible by its excellent community!