2020-09-03 20:18:11 +12:00
|
|
|
defmodule AshPostgres.TestRepo do
|
|
|
|
@moduledoc false
|
|
|
|
use AshPostgres.Repo,
|
|
|
|
otp_app: :ash_postgres
|
2020-09-11 12:26:47 +12:00
|
|
|
|
2022-12-01 14:51:06 +13:00
|
|
|
def on_transaction_begin(data) do
|
|
|
|
send(self(), data)
|
|
|
|
end
|
|
|
|
|
2020-09-11 12:26:47 +12:00
|
|
|
def installed_extensions do
|
2023-08-09 05:20:26 +12:00
|
|
|
["ash-functions", "uuid-ossp", "pg_trgm", "citext", AshPostgres.TestCustomExtension] --
|
2022-09-21 15:00:29 +12:00
|
|
|
Application.get_env(:ash_postgres, :no_extensions, [])
|
2020-09-11 12:26:47 +12:00
|
|
|
end
|
2020-10-29 15:26:45 +13:00
|
|
|
|
2024-08-14 01:57:31 +12:00
|
|
|
def min_pg_version do
|
2024-08-15 23:25:29 +12:00
|
|
|
case System.get_env("PG_VERSION") do
|
|
|
|
nil -> %Version{major: 16, minor: 0, patch: 0}
|
|
|
|
version -> Version.parse!(version)
|
|
|
|
end
|
2024-08-14 01:57:31 +12:00
|
|
|
end
|
|
|
|
|
2020-10-29 15:26:45 +13:00
|
|
|
def all_tenants do
|
|
|
|
Code.ensure_compiled(AshPostgres.MultitenancyTest.Org)
|
|
|
|
|
|
|
|
AshPostgres.MultitenancyTest.Org
|
2024-03-28 09:52:28 +13:00
|
|
|
|> Ash.read!()
|
2020-10-29 15:26:45 +13:00
|
|
|
|> Enum.map(&"org_#{&1.id}")
|
|
|
|
end
|
2020-09-03 20:18:11 +12:00
|
|
|
end
|