Rails 3/Heroku - 推送到 Heroku 时重置数据库时出错 - “类型“文本”不允许使用类型修饰符”
我正在尝试使用 sqlite3 从 Rails 3 应用程序 heroku rake db:reset
,但收到以下错误:
rake aborted!
PGError: ERROR: type modifier is not allowed for type "text"
LINE 1: ...ary key, "name" character varying(255), "content" text(255),...
^
这是我最近的迁移:
change_table :mixes do |t|
t.change :content, :text
t.change :post, :text
end
和我的 schema.rb:
create_table "mixes", :force => true do |t|
t.string "name"
t.text "content", :limit => 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "mixologist"
t.string "link"
t.string "title"
t.text "post", :limit => 255
end
根据我的理解Sqlite3 不对字符串和文本强制限制,我自己也没有添加这些限制。我认为 Heroku 会自动处理那些转换为 Postgres 或它所做的事情。但似乎某些限制正在将其抛在一边。我处理这个问题的最佳方法是什么?
如果我应该发布其他内容,请告诉我。
I'm trying to heroku rake db:reset
from a Rails 3 app using sqlite3, but I'm getting the following error:
rake aborted!
PGError: ERROR: type modifier is not allowed for type "text"
LINE 1: ...ary key, "name" character varying(255), "content" text(255),...
^
here is my most recent migration:
change_table :mixes do |t|
t.change :content, :text
t.change :post, :text
end
and my schema.rb:
create_table "mixes", :force => true do |t|
t.string "name"
t.text "content", :limit => 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "mixologist"
t.string "link"
t.string "title"
t.text "post", :limit => 255
end
From my understanding Sqlite3 doesn't enforce limits on string and text and I didn't add those limits myself. I thought Heroku would automatically handle those in converting to Postgres or whatever it does. But it seems like the limits are throwing it off somewhere. What's the best way for me to deal with this?
Let me know if I should post anything else.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您最近的迁移更改为
这是使用 sqlite3 开发时必须注意的众多细微差别之一:( 仅当您将列的类型从字符串更改为文本时才会发生。
Change your recent migration to
This is one of the many nuances you will have to look out for when developing using sqlite3 :( Only happens when you alter the type of a column from string to text.