summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/migration_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/migration_helpers.rb')
-rw-r--r--lib/gitlab/database/migration_helpers.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index e76c9abbe04..199cbd71f5d 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -184,7 +184,6 @@ module Gitlab
update_arel = Arel::UpdateManager.new(ActiveRecord::Base).
table(table).
- set([[table[column], value]]).
where(table[:id].gteq(start_id))
if stop_row
@@ -195,6 +194,13 @@ module Gitlab
update_arel = yield table, update_arel if block_given?
+ update_arel =
+ if value.is_a?(Proc)
+ value.call(table, update_arel, start_id, stop_id)
+ else
+ update_arel.set([[table[column], value]])
+ end
+
execute(update_arel.to_sql)
# There are no more rows left to update.