rails - data too long for text field, mysql
访问量: 368
refer to:
https://github.com/vinsol-spree-contrib/spree_themes/issues/26
issue description
Mysql2::Error: Data too long for column 'nmap_result' at row 1 (ActiveRecord::ValueTooLong)
from /home/siwei/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.5/lib/mysql2/client.rb:151:in `block in query'
from /home/siwei/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.5/lib/mysql2/client.rb:150:in `handle_interrupt'
from /home/siwei/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/mysql2-0.5.5/lib/mysql2/client.rb:150:in `query'
The field `nmap_result` is text
solution
change it from text to longtext
ruby code: migration: change_column :table, :column_name, :longtext