Skip to content

Commit

Permalink
Merge pull request #205 from dwyl/update-item-text-type-#204
Browse files Browse the repository at this point in the history
PR: Create migration to change `item.text` type from `string` to `text`
  • Loading branch information
nelsonic authored Nov 14, 2022
2 parents f5bd6f1 + 12007de commit 8809718
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions priv/repo/migrations/20221114161649_update_text_type.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule App.Repo.Migrations.UpdateTextType do
use Ecto.Migration

def change do
alter table(:items) do
modify :text, :text
end
end
end
18 changes: 18 additions & 0 deletions test/app/item_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ defmodule App.ItemTest do
assert inserted_item.text == @valid_attrs.text
end

test "create_item/1 with long text" do
attrs = %{
text: "This is a long text, This is a long text,
This is a long text,This is a long text,This is a long text,
This is a long text,This is a long text,This is a long text,
This is a long text,This is a long text,This is a long text,
This is a long text,This is a long text,This is a long text,
This is a long text,This is a long text,This is a long text,
",
person_id: 1,
status: 2
}

assert {:ok, %Item{} = item} = Item.create_item(attrs)

assert item.text == attrs.text
end

test "create_item/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = Item.create_item(@invalid_attrs)
end
Expand Down

0 comments on commit 8809718

Please sign in to comment.