到目前为止,我真的很欣赏将应用程序部署到 Heroku 的便捷性。这是一次很棒的经历。但是,我反复出现错误,但找不到原因。 我致力于最新的 Rails 框架。我上传了所有内容并且应用程序正在运行。但是,当我收到以下错误时,我向表中添加了一些列并尝试执行 rake db:migrate 命令:
输入字符串比 NAMEDATALEN-1 (63) 长
当我用 google 搜索时,我发现 63 是 PostgreSQL 中表名等的输入字符串的最大长度。然而,我检查了所有表名,没有一个与其接近。您对迁移失败的原因有什么建议吗?
相关迁移如下:
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.text :data, :null => false
t.string :category, :null => false
t.string :zip, :limit => 5
t.boolean :published
t.integer :submittedby, :limit => 20
t.integer :reviewedby, :limit => 20
t.integer :likecount,
t.timestamps
end
end
def self.down
drop_table :posts
end
end
最佳答案
该错误是由 :likecount
后面的逗号引起的。
关于postgresql - 数据库:migrate fails on Heroku due NAMEDATALEN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4800001/