From 8fdc465a7d235b449c4b272893b25612a72c1237 Mon Sep 17 00:00:00 2001 From: Nivedita Priyadarshini Date: Thu, 7 Mar 2024 22:45:31 +0530 Subject: [PATCH] Fix data migration for scheduled release to release connection properly --- ...20240305124235_connect_scheduled_releases_with_release.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/db/data/20240305124235_connect_scheduled_releases_with_release.rb b/db/data/20240305124235_connect_scheduled_releases_with_release.rb index 81d09ab46..c95521c44 100644 --- a/db/data/20240305124235_connect_scheduled_releases_with_release.rb +++ b/db/data/20240305124235_connect_scheduled_releases_with_release.rb @@ -13,12 +13,9 @@ def up next if scheduled.blank? scheduled.each do |scheduled_release| - # skip if the scheduled release is not automatic - next unless scheduled_release.is_automatic? - # find a release within a 10 minute window around the scheduled release schedule time target_date = scheduled_release.scheduled_at - release = train.releases.where("scheduled_at >= ? AND scheduled_at <= ?", target_date - 10.minutes, target_date + 10.minutes).first + release = train.releases.where("scheduled_at >= ? AND scheduled_at <= ?", target_date - 10.minutes, target_date + 10.minutes).where(is_automatic: true).first # update the scheduled release if a release was found next if release.blank?