Skip to content

Commit

Permalink
Merge pull request izelnakri#224 from bonfire-networks/main
Browse files Browse the repository at this point in the history
a few things
  • Loading branch information
izelnakri authored Aug 30, 2024
2 parents c9de130 + 09c246f commit e524322
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 44 deletions.
21 changes: 21 additions & 0 deletions lib/paper_trail.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ defmodule PaperTrail do
defdelegate get_version(record), to: PaperTrail.VersionQueries
defdelegate get_version(model_or_record, id_or_options), to: PaperTrail.VersionQueries
defdelegate get_version(model, id, options), to: PaperTrail.VersionQueries
defdelegate has_version?(record), to: PaperTrail.VersionQueries
defdelegate has_version?(model_or_record, id_or_options), to: PaperTrail.VersionQueries
defdelegate has_version?(model, id, options), to: PaperTrail.VersionQueries
defdelegate get_versions(record), to: PaperTrail.VersionQueries
defdelegate get_versions(model_or_record, id_or_options), to: PaperTrail.VersionQueries
defdelegate get_versions(model, id, options), to: PaperTrail.VersionQueries
Expand All @@ -26,6 +29,24 @@ defmodule PaperTrail do
ecto_options: []
]

@doc """
Explicitly inserts a non-versioned already existing record into the Versions table
"""
def initialise(model, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, version_key: :version]) do
case has_version?(model) do
false ->

with {:ok, _} <- make_version_struct(%{event: "insert"}, model, options)
|> PaperTrail.RepoClient.repo().insert() do
:ok
end

_ ->
# already initalised
:ok
end
end

@doc """
Inserts a record to the database with a related version insertion in one transaction
"""
Expand Down
16 changes: 15 additions & 1 deletion lib/paper_trail/multi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,21 @@ defmodule PaperTrail.Multi do
end
end

def update(%Ecto.Multi{} = multi, changeset, options \\ @default_transaction_options) do
def update(multi, changeset, options \\ @default_transaction_options)
def update(%Ecto.Multi{} = multi, %Ecto.Changeset{changes: changes} = changeset, options) when changes==%{} do
# when there's no changes to save, rely on ecto's update being a no-op
model_key = options[:model_key] || :model
ecto_options = options[:ecto_options] || []

multi
|> Ecto.Multi.update(
model_key,
changeset,
ecto_options ++ Keyword.take(options, [:returning])
)
end

def update(%Ecto.Multi{} = multi, changeset, options) do
model_key = options[:model_key] || :model
version_key = options[:version_key] || :version
initial_version_key = options[:initial_version_key] || :initial_version
Expand Down
39 changes: 30 additions & 9 deletions lib/paper_trail/version_queries.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule PaperTrail.VersionQueries do
Gets all the versions of a record given a module and its id
"""
@spec get_versions(model :: module, id :: pos_integer) :: [Version.t()]
def get_versions(model, id) when is_atom(model) and is_integer(id),
def get_versions(model, id) when is_atom(model) and (is_integer(id) or is_binary(id)),
do: get_versions(model, id, [])

@spec get_versions(record :: Ecto.Schema.t(), options :: keyword | []) :: [Version.t()]
Expand Down Expand Up @@ -56,22 +56,37 @@ defmodule PaperTrail.VersionQueries do
def get_version(record), do: get_version(record, [])

@spec get_version(model :: module, id :: pos_integer) :: Version.t() | nil
def get_version(model, id) when is_atom(model) and is_integer(id),
def get_version(model, id) when is_atom(model) and (is_integer(id) or is_binary(id)),
do: get_version(model, id, [])

@spec get_version(record :: Ecto.Schema.t(), options :: keyword | []) :: Version.t() | nil
def get_version(record, options) when is_map(record) do
item_type = record.__struct__ |> Module.split() |> List.last()

last(version_query(item_type, PaperTrail.get_model_id(record), options))
|> PaperTrail.RepoClient.repo().one
get_version(record.__struct__, PaperTrail.get_model_id(record), options)
end

@spec get_version(model :: module, id :: pos_integer, options :: keyword | []) ::
Version.t() | nil
def get_version(model, id, options) do
item_type = model |> Module.split() |> List.last()
last(version_query(item_type, id, options)) |> PaperTrail.RepoClient.repo().one
last(version_query(model, id, options))
|> PaperTrail.RepoClient.repo().one
end

@spec has_version?(record :: Ecto.Schema.t()) :: boolean
def has_version?(record), do: has_version?(record, [])

@spec has_version?(model :: module, id :: pos_integer) :: boolean
def has_version?(model, id) when is_atom(model) and (is_integer(id) or is_binary(id)),
do: has_version?(model, id, [])

@spec has_version?(record :: Ecto.Schema.t(), options :: keyword | []) :: boolean
def has_version?(record, options) when is_map(record) do
has_version?(record.__struct__, PaperTrail.get_model_id(record), options)
end

@spec has_version?(model :: module, id :: pos_integer, options :: keyword | []) :: boolean
def has_version?(model, id, options) do
version_query(model, id, options)
|> PaperTrail.RepoClient.repo().exists?()
end

@doc """
Expand All @@ -89,7 +104,13 @@ defmodule PaperTrail.VersionQueries do
from(v in Version, where: v.item_type == ^item_type and v.item_id == ^id)
end

defp version_query(item_type, id, options) do
defp version_query(model, id, options) when is_atom(model) do
model
|> Module.split()
|> List.last()
|> version_query(id, options)
end
defp version_query(item_type, id, options) when is_binary(item_type) do
with opts <- Enum.into(options, %{}) do
version_query(item_type, id)
|> Ecto.Queryable.to_query()
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ defmodule PaperTrail.Mixfile do

defp deps do
[
{:ecto, ">= 3.9.2"},
{:ecto_sql, ">= 3.9.1"},
{:ecto, ">= 3.10.2"},
{:ecto_sql, ">= 3.10.1"},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:jason, ">= 1.4.0", only: [:dev, :test]},
{:postgrex, ">= 0.0.0", only: [:dev, :test]}
Expand Down
22 changes: 11 additions & 11 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
%{
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
"db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
"ecto": {:hex, :ecto, "3.9.2", "017db3bc786ff64271108522c01a5d3f6ba0aea5c84912cfb0dd73bf13684108", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21466d5177e09e55289ac7eade579a642578242c7a3a9f91ad5c6583337a9d15"},
"ecto_sql": {:hex, :ecto_sql, "3.9.1", "9bd5894eecc53d5b39d0c95180d4466aff00e10679e13a5cfa725f6f85c03c22", [:mix], [{:db_connection, "~> 2.5 or ~> 2.4.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5fd470a4fff2e829bbf9dcceb7f3f9f6d1e49b4241e802f614de6b8b67c51118"},
"ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"},
"db_connection": {:hex, :db_connection, "2.5.0", "bb6d4f30d35ded97b29fe80d8bd6f928a1912ca1ff110831edcd238a1973652c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c92d5ba26cd69ead1ff7582dbb860adeedfff39774105a4f1c92cbb654b55aa2"},
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"earmark_parser": {:hex, :earmark_parser, "1.4.32", "fa739a0ecfa34493de19426681b23f6814573faee95dfd4b4aafe15a7b5b32c6", [:mix], [], "hexpm", "b8b0dd77d60373e77a3d7e8afa598f325e49e8663a51bcc2b88ef41838cca755"},
"ecto": {:hex, :ecto, "3.10.2", "6b887160281a61aa16843e47735b8a266caa437f80588c3ab80a8a960e6abe37", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6a895778f0d7648a4b34b486af59a1c8009041fbdf2b17f1ac215eb829c60235"},
"ecto_sql": {:hex, :ecto_sql, "3.10.1", "6ea6b3036a0b0ca94c2a02613fd9f742614b5cfe494c41af2e6571bb034dd94c", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.10.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 0.17.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f6a25bdbbd695f12c8171eaff0851fa4c8e72eec1e98c7364402dda9ce11c56b"},
"ex_doc": {:hex, :ex_doc, "0.29.4", "6257ecbb20c7396b1fe5accd55b7b0d23f44b6aa18017b415cb4c2b91d997729", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2c6699a737ae46cb61e4ed012af931b57b699643b24dabe2400a8168414bc4f5"},
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
"postgrex": {:hex, :postgrex, "0.16.5", "fcc4035cc90e23933c5d69a9cd686e329469446ef7abba2cf70f08e2c4b69810", [:mix], [{:connection, "~> 1.1", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "edead639dc6e882618c01d8fc891214c481ab9a3788dfe38dd5e37fd1d5fb2e8"},
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
"postgrex": {:hex, :postgrex, "0.17.1", "01c29fd1205940ee55f7addb8f1dc25618ca63a8817e56fac4f6846fc2cddcbe", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "14b057b488e73be2beee508fb1955d8db90d6485c6466428fe9ccf1d6692a555"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
}
4 changes: 2 additions & 2 deletions test/paper_trail/bang_functions_simple_mode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ defmodule PaperTrailTest.SimpleModeBangFunctions do
Application.put_env(:paper_trail, :strict_mode, false)
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Application.put_env(:paper_trail, :originator_type, :integer)
Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")


MultiTenant.setup_tenant(repo())
:ok
end
Expand Down
4 changes: 2 additions & 2 deletions test/paper_trail/bang_functions_strict_mode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ defmodule PaperTrailTest.StrictModeBangFunctions do
Application.put_env(:paper_trail, :strict_mode, true)
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Application.put_env(:paper_trail, :originator_type, :integer)
Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")


MultiTenant.setup_tenant(repo())
:ok
end
Expand Down
17 changes: 15 additions & 2 deletions test/paper_trail/base_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ defmodule PaperTrailTest do
setup_all do
Application.put_env(:paper_trail, :strict_mode, false)
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")


:ok
end

Expand Down Expand Up @@ -688,6 +688,19 @@ defmodule PaperTrailTest do
|> PaperTrail.update(origin: "admin")
end

test "updating a company with current params should not create a version" do
{:ok, insert_result} = create_company_with_version()

{:ok, update_result} =
update_company_with_version(
insert_result[:model],
@create_company_params,
[]
)

assert PaperTrail.get_version(insert_result[:model]) == insert_result[:version]
end

defp create_user do
User.changeset(%User{}, %{token: "fake-token", username: "izelnakri"}) |> @repo.insert!
end
Expand Down
4 changes: 2 additions & 2 deletions test/paper_trail/strict_mode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ defmodule PaperTrailStrictModeTest do
setup_all do
Application.put_env(:paper_trail, :strict_mode, true)
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")


:ok
end

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Application.start(:postgrex)

Application.put_env(:paper_trail, :ecto_repos, [PaperTrail.Repo, PaperTrail.UUIDRepo, PaperTrail.UUIDWithCustomNameRepo])
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Application.put_env(:paper_trail, :originator, [name: :user, model: User])

Mix.Task.run("ecto.drop")
Mix.Task.run("ecto.create")
Mix.Task.run("ecto.migrate")
Expand All @@ -8,12 +12,6 @@ PaperTrail.Repo.start_link()
PaperTrail.UUIDRepo.start_link()
PaperTrail.UUIDWithCustomNameRepo.start_link()

Code.require_file("test/support/multi_tenant_helper.exs")
Code.require_file("test/support/simple_models.exs")
Code.require_file("test/support/strict_models.exs")
Code.require_file("test/support/uuid_models.exs")
Code.require_file("test/support/uuid_with_custom_name_models.exs")

ExUnit.configure(seed: 0)

ExUnit.start(capture_log: true)
4 changes: 2 additions & 2 deletions test/uuid/uuid_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ defmodule PaperTrailTest.UUIDTest do
if(System.get_env("STRING_TEST") == nil, do: Ecto.UUID, else: :string)
)

Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")



repo().delete_all(Version)
repo().delete_all(Admin)
Expand Down
4 changes: 2 additions & 2 deletions test/uuid/uuid_with_custom_name_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ defmodule PaperTrailTest.UUIDWithCustomNameTest do
if(System.get_env("STRING_TEST") == nil, do: Ecto.UUID, else: :string)
)

Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")



repo().delete_all(Version)
repo().delete_all(Person)
Expand Down
4 changes: 2 additions & 2 deletions test/version/paper_trail_version_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ defmodule PaperTrailTest.Version do
Application.put_env(:paper_trail, :strict_mode, false)
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Application.put_env(:paper_trail, :originator_type, :integer)
Code.eval_file("lib/paper_trail.ex")
Code.eval_file("lib/version.ex")


MultiTenant.setup_tenant(repo())
:ok
end
Expand Down
2 changes: 1 addition & 1 deletion test/version/version_queries_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule PaperTrailTest.VersionQueries do
setup_all do
Application.put_env(:paper_trail, :repo, PaperTrail.Repo)
Application.put_env(:paper_trail, :originator_type, :integer)
Code.eval_file("lib/version.ex")

MultiTenant.setup_tenant(repo())
reset_all_data()

Expand Down

0 comments on commit e524322

Please sign in to comment.