From 0a2744a5ae7f851c734a417e2f4e3cc47ae171c3 Mon Sep 17 00:00:00 2001 From: Guilherme Date: Thu, 27 Feb 2020 11:43:22 +0100 Subject: [PATCH 1/2] Do not start postgrex application by default --- mix.exs | 2 +- test/test_helper.exs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 6b402635..90437c41 100644 --- a/mix.exs +++ b/mix.exs @@ -20,7 +20,7 @@ defmodule PaperTrail.Mixfile do # Type "mix help compile.app" for more information def application do [ - applications: [:logger, :postgrex, :ecto, :runtime_tools] + applications: [:logger, :ecto, :runtime_tools] ] end diff --git a/test/test_helper.exs b/test/test_helper.exs index 95213569..67b4cac5 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,3 +1,5 @@ +Application.start(:postgrex) + Mix.Task.run("ecto.drop") Mix.Task.run("ecto.create") Mix.Task.run("ecto.migrate") From 6494f6fd7feaf846bebf74001732dda87cd83824 Mon Sep 17 00:00:00 2001 From: Guilherme Date: Thu, 27 Feb 2020 12:31:54 +0100 Subject: [PATCH 2/2] Make read_after_writes for origin optional MariaDb only support this for primary keys --- lib/version.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/version.ex b/lib/version.ex index 56c99f4b..fe5ffd4c 100644 --- a/lib/version.ex +++ b/lib/version.ex @@ -14,7 +14,11 @@ defmodule PaperTrail.Version do field(:item_id, Application.get_env(:paper_trail, :item_type, :integer)) field(:item_changes, :map) field(:originator_id, Application.get_env(:paper_trail, :originator_type, :integer)) - field(:origin, :string, read_after_writes: true) + + field(:origin, :string, + read_after_writes: Application.get_env(:paper_trail, :origin_read_after_writes, true) + ) + field(:meta, :map) if PaperTrail.RepoClient.originator() do