Skip to content

Commit ede4cc6

Browse files
authored
docs: Mention :define_ecto_repo? option of use AshPostgres.Repo macro in getting started guide (#648)
Added instructions for integrating AshPostgres with existing Ecto.Repo.
1 parent e07b602 commit ede4cc6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

documentation/tutorials/get-started-with-ash-postgres.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ defmodule Helpdesk.Repo do
5656
end
5757
```
5858

59+
If your project already defines its own `Ecto.Repo` (for example, to integrate with third-party libraries such as AppSignal), you can prevent `AshPostgres.Repo` from automatically defining one by setting the `define_ecto_repo?: false` option:
60+
61+
```elixir
62+
# in lib/helpdesk/repo.ex
63+
64+
defmodule Helpdesk.Repo do
65+
use Appsignal.Ecto.Repo,
66+
otp_app: :helpdesk,
67+
adapter: Ecto.Adapters.Postgres
68+
69+
use AshPostgres.Repo,
70+
define_ecto_repo?: false
71+
72+
def installed_extensions do
73+
["ash-functions"]
74+
end
75+
end
76+
```
77+
78+
This lets you keep full control over your existing `Ecto.Repo` definition while still enabling AshPostgres features.
79+
80+
5981
Next we will need to create configuration files for various environments. Run the following to create the configuration files we need.
6082

6183
```bash

0 commit comments

Comments
 (0)