ash_postgres/lib/repo/before_compile.ex
Zach Daniel 10cf60cdc1 fix: remove Agent "convenience" for determining min pg version
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.
2024-08-13 09:58:25 -04:00

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