我需要在我的 Rails 脚本中将列类型从 text 更改为 longtext,但是找不到关于如何做到这一点的任何信息。
有人碰到过这个吗?
谢谢! 丹尼斯
The text type handles tinytext, text, mediumtext, and longtext for MySQL, if that's what you're using. Just specify the upper bound using :limit => ...
text
tinytext
mediumtext
longtext
:limit => ...
Example:
change_column :articles, :body, :text, :limit => 4294967295
The default value of limit is 65535, as expected.
limit
1 to 255 bytes: TINYTEXT 256 to 65535 bytes: TEXT 65536 to 16777215 bytes: MEDIUMTEXT 16777216 to 4294967295 bytes: LONGTEXT
The MySQL documentation can be found here.