提交 da74e97c 编写于 作者: S Stan Hu

Use default_value_for to set notified_of_own_activity instead of using a DB migration

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册