From 5b69b5538f50a5f6d76ebab37c827f81e459a178 Mon Sep 17 00:00:00 2001 From: CharlesDelannoy Date: Thu, 16 May 2024 10:16:26 +0200 Subject: [PATCH] Revert change that may cause issue when accessing other attributes than the PK --- lib/safe-pg-migrations/helpers/batch_over.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/safe-pg-migrations/helpers/batch_over.rb b/lib/safe-pg-migrations/helpers/batch_over.rb index 8d5ffb45..d256b8ec 100644 --- a/lib/safe-pg-migrations/helpers/batch_over.rb +++ b/lib/safe-pg-migrations/helpers/batch_over.rb @@ -19,11 +19,11 @@ def each_batch def next_batch return if endless? - first = next_scope.select(primary_key).take + first = next_scope.take return unless first - last = next_scope.select(primary_key).offset(@of).take + last = next_scope.offset(@of).take first_key = first[primary_key] last_key = last.nil? ? nil : last[primary_key]