Allow customising of queries used for `update_column_in_batches`
What does this MR do?
This MR makes two changes to add_column_with_default
and update_column_in_batches
:
-
add_column_with_default
no longer wraps the entire set of updates in a single transaction, preventing any locks from sticking around for the duration of the entire transaction -
update_column_in_batches
now takes a block which can be used to customise the queries. This uses Arel as messing with raw SQL strings is a total pain
Are there points in the code the reviewer needs to double check?
No.
Why was this MR needed?
In !4381 (merged) there's a need for updating existing rows/columns in a table in batches using a custom WHERE
condition. Without the changes in this MR this would not be possible.
What are the relevant issue numbers?
None.
Does this MR meet the acceptance criteria?
-
CHANGELOG entry added -
Documentation created/updated -
API support added -
Tests -
Added for this feature/bug -
All builds are passing
-
-
Conform by the style guides -
Branch has no merge conflicts with master
(if you do - rebase it please) -
Squashed related commits together