Commit da74e97c authored by Stan Hu's avatar Stan Hu

Use default_value_for to set notified_of_own_activity instead of using a DB migration

parent e1bb8c99
......@@ -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,
......
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
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment