[SOLVED]: ERROR 22001 (string_data_right_truncation): value too long for type character varying(255)

July 21, 2018
ERROR 22001 (string_data_right_truncation): value too long for type character varying(255)

This is an ecto error that occurs when trying to put more than 255 characters into a field that has an ecto type of :string.

To solve this be sure that your migration for the field is of type :text:

  def change do
    create table(:photos) do
      add :url, :text
      add :caption, :text

      timestamps()
    end
  end

Made it this far? Have a go at the game of snake