From 5b955957c879f0ffa0358faa89ecdacce39cea96 Mon Sep 17 00:00:00 2001 From: Stefan Luptak Date: Tue, 11 Nov 2025 20:54:02 +0100 Subject: [PATCH] Mention :define_ecto_repo? option of use AshPostgres.Repo macro in getting started guide Added instructions for integrating AshPostgres with existing Ecto.Repo. --- .../get-started-with-ash-postgres.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/documentation/tutorials/get-started-with-ash-postgres.md b/documentation/tutorials/get-started-with-ash-postgres.md index f96c8659..c87501ce 100644 --- a/documentation/tutorials/get-started-with-ash-postgres.md +++ b/documentation/tutorials/get-started-with-ash-postgres.md @@ -56,6 +56,28 @@ defmodule Helpdesk.Repo do end ``` +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: + +```elixir +# in lib/helpdesk/repo.ex + +defmodule Helpdesk.Repo do + use Appsignal.Ecto.Repo, + otp_app: :helpdesk, + adapter: Ecto.Adapters.Postgres + + use AshPostgres.Repo, + define_ecto_repo?: false + + def installed_extensions do + ["ash-functions"] + end +end +``` + +This lets you keep full control over your existing `Ecto.Repo` definition while still enabling AshPostgres features. + + Next we will need to create configuration files for various environments. Run the following to create the configuration files we need. ```bash