summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-22 11:36:11 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-06-22 11:36:11 -0400
commitaedb546964cc6b6e456369bf17a3d917089f7017 (patch)
tree6fd7830068030dd5f79abb35d5ffc472c0103507 /db
parentd3ff8c1a952b6bee75eac80f4ac61a7b70cb4eb0 (diff)
downloadgitlab-ce-aedb546964cc6b6e456369bf17a3d917089f7017.tar.gz
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.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150620233230_add_default_otp_required_for_login_value.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb b/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
index c209fa4e80f..8eed8678b2f 100644
--- a/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
+++ b/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
@@ -1,9 +1,11 @@
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