mar*_*ion 28 postgresql ruby-on-rails heroku ruby-on-rails-3
所以我有一个comments结构如下的表:
# == 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)
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误消息:
ActiveRecord::StatementInvalid (PGError: ERROR: value too long for type character varying(255)
Run Code Online (Sandbox Code Playgroud)
如何使用Rails 3.x和Heroku在PG列中存储长文本?
迁移将如何解决此问题?
谢谢.
Yul*_*ule 60
您需要使用文本而不是字符串.
迁移将有以下几点:
change_column :comments, :body, :text, :limit => nil
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11334 次 |
| 最近记录: |