File size: 777 Bytes
6778ee0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
defmodule Plausible.Audit.TestSchema do
  @moduledoc false

  use Plausible

  on_ee do
    use Ecto.Schema

    @derive {Plausible.Audit.Encoder, only: [:id, :name]}

    schema "tests" do
      field :name, :string
    end

    defmodule VariantWithAssociation do
      @moduledoc false
      use Ecto.Schema

      on_ee do
        @derive {Plausible.Audit.Encoder, only: [:id, :team]}
      end

      schema "tests" do
        belongs_to :team, Plausible.Teams.Team
      end
    end

    defmodule VariantWithAssociationAllowNotLoaded do
      @moduledoc false
      use Ecto.Schema

      @derive {Plausible.Audit.Encoder, only: [:id, :team], allow_not_loaded: [:team]}

      schema "tests" do
        belongs_to :team, Plausible.Teams.Team
      end
    end
  end
end