在开发中,我使用了 sqlite3,并且正在编写一个博客应用程序。因此,对于博客文章,我的数据类型文本效果很好。我能够写出很长的文章,从来没有遇到过问题。切换到使用 MySQL 的生产环境,现在我的文章在大约 250 个字符后被截断。
有谁知道我需要做什么和/或更改以使 MySQL 的行为像 sqlite3 一样,允许非常大的文本体?
谢谢。
db/schema.rb:
ActiveRecord::Schema.define(:version => 20110307222323) do
create_table "articles", :force => true do |t|
t.integer "user_id"
t.string "title"
t.string "body"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "category_id"
t.string "url"
end
end
最佳答案
也许你应该更换
t.string :body
与
t.text :body
关于mysql - mysql 中的数据类型文本(Ruby on Rails),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5617406/