ash_postgres v0.40.9 AshPostgres.Repo behaviour View Source

Resources that use the AshPostgres data layer use a Repo to access the database.

This repo is a slightly modified version of an Ecto.Repo.

You can use Ecto.Repo's init/2 to configure your repo like normal, but instead of returning {:ok, config}, use super(config) to pass the configuration to the AshPostgres.Repo implementation.

Installed Extensions

To configure your list of installed extensions, define installed_extensions/0

Extensions that are relevant to ash_postgres:

  • "uuid-ossp" - Sets UUID primary keys defaults in the migration generator
  • "pg_trgm" - Makes the AshPostgres.Predicates.Trigram custom predicate available
  • "citext" - Allows case insensitive fields to be used
def installed_extensions() do
  ["pg_trgm", "uuid-ossp"]
end

Link to this section Summary

Callbacks

Return a list of all schema names (only relevant for a multitenant implementation)

The default prefix(postgres schema) to use when building queries

Use this to inform the data layer about what extensions are installed

The path where your migrations are stored

The path where your tenant migrations are stored (only relevant for a multitenant implementation)

Link to this section Callbacks

Specs

all_tenants() :: [String.t()]

Return a list of all schema names (only relevant for a multitenant implementation)

Specs

default_prefix() :: String.t()

The default prefix(postgres schema) to use when building queries

Specs

installed_extensions() :: [String.t()]

Use this to inform the data layer about what extensions are installed

Specs

migrations_path() :: String.t()

The path where your migrations are stored

Link to this callback

tenant_migrations_path()

View Source

Specs

tenant_migrations_path() :: String.t()

The path where your tenant migrations are stored (only relevant for a multitenant implementation)