So I have a comments
table that is structured like this:
# == Schema Information # # Table name: comments # # id :integer not null, primary key # body :string(255) # notified :boolean # user_id :integer # stage_id :integer # created_at :datetime # updated_at :datetime # client_id :integer # author :string(255)
This is the error message I am getting:
ActiveRecord::StatementInvalid (PGError: ERROR: value too long for type character varying(255)
How do I store long text in a PG column using Rails 3.x and Heroku?
What would the migration look like to fix this issue?
Thanks.
You would need to use text instead of string.
Migration would be something along the lines of:
change_column :comments, :body, :text, :limit => nil
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With