Skip to content

Commit

Permalink
originator field removed from the paper_trail library
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Jul 15, 2016
1 parent fadb54a commit 9b7ba24
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
1 change: 1 addition & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
originator is optional on the PaperTrail.Version.meta field
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defmodule Repo.Migrations.AddVersions do
add :item_id, :integer
add :item_changes, :map
add :meta, :map
add :originator, :string

add :inserted_at, :datetime, null: false
end
Expand Down
5 changes: 1 addition & 4 deletions example/test/company_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,12 @@ defmodule CompanyTest do
founded_in: nil
}

version |> inspect |> IO.puts

assert Map.drop(version, [:id]) == %{
event: "create",
item_type: "Company",
item_id: Repo.one(first(Company, :id)).id,
item_changes: Map.drop(result[:model], [:__meta__, :__struct__]),
meta: nil,
originator: nil
meta: nil
}
end

Expand Down
1 change: 0 additions & 1 deletion lib/mix/tasks/papertrail/install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ defmodule Mix.Tasks.Papertrail.Install do
add :item_id, :integer
add :item_changes, :map
add :meta, :map
add :originator, :string
add :inserted_at, :datetime, null: false
end
Expand Down
5 changes: 2 additions & 3 deletions lib/version.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ defmodule PaperTrail.Version do
field :item_id, :integer
field :item_changes, :map
field :meta, :map
field :originator, :string

timestamps(updated_at: false)
end

@required_fields ~w(item_type item_id event created_at)
@optional_fields ~w(meta originator)
@required_fields ~w(event item_type item_id created_at)
@optional_fields ~w(meta)

@doc """
Creates a changeset based on the `model` and `params`.
Expand Down
1 change: 0 additions & 1 deletion priv/repo/migrations/20160619190936_add_versions.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defmodule Repo.Migrations.AddVersions do
add :item_id, :integer
add :item_changes, :map
add :meta, :map
add :originator, :string

add :inserted_at, :datetime, null: false
end
Expand Down

0 comments on commit 9b7ba24

Please sign in to comment.