Use default_value_for to set notified_of_own_activity instead of using a DB migration

This commit is contained in:
Stan Hu 2017-03-24 15:06:36 -07:00
parent e1bb8c99cf
commit da74e97c89
3 changed files with 2 additions and 21 deletions

View file

@ -22,6 +22,7 @@ class User < ActiveRecord::Base
default_value_for :hide_no_ssh_key, false
default_value_for :hide_no_password, false
default_value_for :project_view, :files
default_value_for :notified_of_own_activity, false
attr_encrypted :otp_secret,
key: Gitlab::Application.secrets.otp_key_base,

View file

@ -1,20 +0,0 @@
class AddNotifiedOfOwnActivityDefault < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
DOWNTIME = false
def up
begin
update_column_in_batches(:users, :notified_of_own_activity, false) do |table, query|
query.where(table[:notified_of_own_activity].eq(nil))
end
change_column :users, :notified_of_own_activity, :boolean, default: false, null: false
end
end
def down
change_column_default :users, :notified_of_own_activity, nil
end
end

View file

@ -1236,7 +1236,7 @@ ActiveRecord::Schema.define(version: 20170317203554) do
t.string "organization"
t.boolean "authorized_projects_populated"
t.boolean "ghost"
t.boolean "notified_of_own_activity", default: false, null: false
t.boolean "notified_of_own_activity"
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree