diff options
| author | Sean McGivern <sean@gitlab.com> | 2017-11-17 16:02:10 +0000 |
|---|---|---|
| committer | Sean McGivern <sean@gitlab.com> | 2017-11-17 16:56:50 +0000 |
| commit | 4d367dd40037500fd7b96059fa300cbe2ce28e85 (patch) | |
| tree | cdd111d32bc801c9425e732b8f8075a1e1c719b1 /lib | |
| parent | d8be981466e2a794b42996960f1fdb91e560a707 (diff) | |
| download | gitlab-ce-4d367dd40037500fd7b96059fa300cbe2ce28e85.tar.gz | |
Add computed update docs for update_column_in_batches
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 2c35da8f1aa..c276c3566b4 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -220,6 +220,15 @@ module Gitlab # column - The name of the column to update. # value - The value for the column. # + # The `value` argument is typically a literal. To perform a computed + # update, an Arel literal can be used instead: + # + # update_value = Arel.sql('bar * baz') + # + # update_column_in_batches(:projects, :foo, update_value) do |table, query| + # query.where(table[:some_column].eq('hello')) + # end + # # Rubocop's Metrics/AbcSize metric is disabled for this method as Rubocop # determines this method to be too complex while there's no way to make it # less "complex" without introducing extra methods (which actually will |
