提交 aedb5469 编写于 作者: R Robert Speicher

Correct AddDefaultOtpRequiredForLoginValue migration

Also MySQL complains when you change a field to be not null if any
existing records already have a null value, so this updates those rows.
上级 d3ff8c1a
class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration
def up
execute %q{UPDATE users SET otp_required_for_login = FALSE WHERE otp_required_for_login IS NULL}
change_column :users, :otp_required_for_login, :boolean, default: false, null: false
end
def down
change_column :users, :otp_required_for_login, :boolean, default: nil
change_column :users, :otp_required_for_login, :boolean, null: true
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册