Skip to content
Snippets Groups Projects
Commit aedb5469 authored by Robert Speicher's avatar Robert Speicher
Browse files

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.
parent d3ff8c1a
No related branches found
No related tags found
1 merge request!852Allow Admin to filter users by 2FA status
Pipeline #
class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration
def up 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 change_column :users, :otp_required_for_login, :boolean, default: false, null: false
end end
   
def down def down
change_column :users, :otp_required_for_login, :boolean, default: nil change_column :users, :otp_required_for_login, :boolean, null: true
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment