dwyl / mvp

📲 simplest version of the @dwyl app
https://mvp.fly.dev
GNU General Public License v2.0
87 stars 2 forks source link

Change field type to `:text` for the item text #204

Closed SimonLab closed 1 year ago

SimonLab commented 1 year ago

The application can fail to create a new item when the text content is too long:

(Postgrex.Error) ERROR 22001 (string_data_right_truncation) value too long for type character varying(255)

This is due to the migration defining the text value as :string: https://github.com/dwyl/mvp/blob/f5bd6f1880378260091de62fa7528f8753649cb9/priv/repo/migrations/20220627162154_create_items.exs#L6

alter table(:items) do
  modify :text, :text
end
nelsonic commented 1 year ago

Also: https://github.com/dwyl/mvp/blob/f5bd6f1880378260091de62fa7528f8753649cb9/lib/app/item.ex#L10

SimonLab commented 1 year ago

Ecto is using the type :sring in the schema, see: https://github.com/dwyl/mvp/pull/205#issuecomment-1314039013

SimonLab commented 1 year ago

Fixed with #205

nelsonic commented 1 year ago

Thanks @SimonLab 👌