Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20170317131326_add_notified_of_own_activity_default.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f01ef6b41194f444df5dbd84c6cac1d3229000ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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