1

In my Heroku postgres db, I had a column of type "string" with a limit of "50" characters.

I just made a migration that changed the limit to 80 characters.

class ChangeTagLineLimit < ActiveRecord::Migration
  def up
    change_column :blocks, :tag_line, :string, :limit => 80
  end
  def down
    change_column :blocks, :tag_line, :string, :limit => 50
  end
end

However when I try to save a record, I get this error:

PG::StringDataRightTruncation: ERROR: value too long for type character varying(50)

It sounds like PostGRES hasn't changed the size of the varchar column. How do I fix this?

0

1 Answer 1

1

That migration should work. The error is probably related to another table that didn't get migrated yet.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.