新手问题 Rails 如何用 migrate 修改字符集?

nemo733 · October 26, 2015 · Last by nemo733 replied at October 26, 2015 · 1700 hits

Mysql::Error: Incorrect string value: '\xE7\x94\xB7' for column 'gender' . 在 migration 文件中修改某一列字符集编码如何书写?

class Xxx < ActiveRecord::Migration
  def up
    execute "ALTER TABLE....."
  end

  def down
    execute "ALTER TABLE..."
  end
end

#1 楼 @huobazi 好的,一直在找固定用法,这样有数据库基础直接执行 execute 就方便多了

You need to Sign in before reply, if you don't have an account, please Sign up first.