Skip to content

Commit

Permalink
Avoid module not compiled warning caused by @version_schema in ExAudi…
Browse files Browse the repository at this point in the history
…t.Queryable
  • Loading branch information
hisapy committed Apr 20, 2020
1 parent e802ff6 commit 1e98604
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/repo/queryable.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
defmodule ExAudit.Queryable do
@version_schema Application.get_env(:ex_audit, :version_schema)

require Logger

defp version_schema() do
Application.get_env(:ex_audit, :version_schema)
end

@compile {:inline, version_schema: 0}

def update_all(module, queryable, updates, opts) do
Ecto.Repo.Queryable.update_all(module, queryable, updates, opts)
end
Expand All @@ -16,7 +20,7 @@ defmodule ExAudit.Queryable do

query =
from(
v in @version_schema,
v in version_schema(),
order_by: [desc: :recorded_at]
)

Expand Down Expand Up @@ -60,7 +64,7 @@ defmodule ExAudit.Queryable do

versions ++
[
struct(@version_schema, %{
struct(version_schema(), %{
id: oldest_id
})
|> Map.put(:original, empty_map_to_nil(oldest_struct))
Expand All @@ -79,7 +83,7 @@ defmodule ExAudit.Queryable do

query =
from(
v in @version_schema,
v in version_schema(),
where: v.entity_id == ^version.entity_id,
where: v.entity_schema == ^version.entity_schema,
where: v.recorded_at >= ^version.recorded_at,
Expand Down

0 comments on commit 1e98604

Please sign in to comment.