mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
10cf60cdc1
We need to require that users provide this function. To that end we're adding a warning in a minor release branch telling users to define this. The agent was acting as a bottleneck that all queries must go through, causing nontrivial performance issues at scale.
25 lines
606 B
Elixir
25 lines
606 B
Elixir
defmodule AshPostgres.Repo.BeforeCompile do
|
|
@moduledoc false
|
|
|
|
defmacro __before_compile__(_env) do
|
|
quote do
|
|
unless Module.defines?(__MODULE__, {:min_pg_version, 0}, :def) do
|
|
IO.warn("""
|
|
Please define `min_pg_version/0` in repo module: #{inspect(__MODULE__)}
|
|
|
|
For example:
|
|
|
|
def min_pg_version do
|
|
%Version{major: 16, minor: 0, patch: 0}
|
|
end
|
|
|
|
The lowest compatible version is being assumed.
|
|
""")
|
|
|
|
def min_pg_version do
|
|
%Version{major: 13, minor: 0, patch: 0}
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|