Skip to content

Commit

Permalink
STR to STRING_TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
devvit authored and devvit committed Mar 14, 2018
1 parent e1867b1 commit 9cc9a02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule PaperTrail.UUIDRepo.Migrations.CreateVersions do
create table(:versions) do
add :event, :string, null: false, size: 10
add :item_type, :string, null: false
add :item_id, (if System.get_env("STR") == nil, do: :binary_id, else: :string)
add :item_id, (if System.get_env("STRING_TEST") == nil, do: :binary_id, else: :string)
add :item_changes, :map, null: false
add :originator_id, references(:admins, type: :binary_id)
add :origin, :string, size: 50
Expand Down
6 changes: 3 additions & 3 deletions test/paper_trail/uuid_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule PaperTrailTest.UUIDTest do
Application.put_env(:paper_trail, :repo, PaperTrail.UUIDRepo)
Application.put_env(:paper_trail, :originator, name: :admin, model: Admin)
Application.put_env(:paper_trail, :originator_type, Ecto.UUID)
Application.put_env(:paper_trail, :item_type, (if System.get_env("STR") == nil, do: Ecto.UUID, else: :string))
Application.put_env(:paper_trail, :item_type, (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)
Expand Down Expand Up @@ -59,7 +59,7 @@ defmodule PaperTrailTest.UUIDTest do
assert version.item_id == item.item_id
end

test "versioning models that have a integer primary key" do
test "test INTEGER primary key for item_type == :string" do
if PaperTrail.Version.__schema__(:type, :item_id) == :string do
item =
%FooItem{}
Expand All @@ -71,7 +71,7 @@ defmodule PaperTrailTest.UUIDTest do
end
end

test "versionming models that have a string primary key" do
test "test STRING primary key for item_type == :string" do
if PaperTrail.Version.__schema__(:type, :item_id) == :string do
item =
%BarItem{}
Expand Down

0 comments on commit 9cc9a02

Please sign in to comment.