diff options
Diffstat (limited to 'db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb')
-rw-r--r-- | db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb b/db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb new file mode 100644 index 00000000000..f01ef6b4119 --- /dev/null +++ b/db/post_migrate/20170317131326_add_notified_of_own_activity_default.rb @@ -0,0 +1,20 @@ +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 |