Skip to content

Commit

Permalink
Merge pull request #138 from doctolib/batch-over-select-id
Browse files Browse the repository at this point in the history
BatchRecord: select primary keys instead of full records
  • Loading branch information
maximerety authored Feb 26, 2024
2 parents 15bac4a + 427fe31 commit fe0be8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/safe-pg-migrations/helpers/batch_over.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def each_batch
def next_batch
return if endless?

first = next_scope.take
first = next_scope.select(primary_key).take

return unless first

last = next_scope.offset(@of).take
last = next_scope.select(primary_key).offset(@of).take

first_key = first[primary_key]
last_key = last.nil? ? nil : last[primary_key]
Expand Down

0 comments on commit fe0be8d

Please sign in to comment.