开发者

Rails 3 Migration with longtext

开发者 https://www.devze.com 2023-01-31 03:03 出处:网络
I am needing to change a column type from text to longtext in my Rails script, but can\'t fi开发者_如何学JAVAnd anything on how to do this.

I am needing to change a column type from text to longtext in my Rails script, but can't fi开发者_如何学JAVAnd anything on how to do this.

Has anyone ran across this?

Thanks! Dennis


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 => ...

Example:

change_column :articles, :body, :text, :limit => 4294967295

The default value of limit is 65535, as expected.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消