From d51ab9d8cbe888a63c6f321f8601952eaa110275 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Thu, 19 May 2011 08:31:31 +0200 Subject: [PATCH] fix: because version.start_date returns the earliest start date of the associated issues if no own start_date is set, we have to read the attribute :start_date directly when making executing the sprint_start_date/start_date migration --- db/migrate/20110513130147_remove_sprint_start_date.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/20110513130147_remove_sprint_start_date.rb b/db/migrate/20110513130147_remove_sprint_start_date.rb index faf4844364..152f7c1e28 100644 --- a/db/migrate/20110513130147_remove_sprint_start_date.rb +++ b/db/migrate/20110513130147_remove_sprint_start_date.rb @@ -8,12 +8,12 @@ class RemoveSprintStartDate < ActiveRecord::Migration Version.transaction do Version.all.each do |version| - if version.sprint_start_date.present? and version.start_date.present? and - version.sprint_start_date != version.start_date + if version.sprint_start_date.present? and version.read_attribute(:start_date).present? and + version.sprint_start_date != version.read_attribute(:start_date) raise "Version #{version.id} has a start date and a sprint start date! Migrations were not executed in the correct order" - elsif version.sprint_start_date.present? and version.start_date.blank? + elsif version.sprint_start_date.present? and version.read_attribute(:start_date).blank? puts "Copying sprint_start_date to start_date for Sprint #{version.id} - #{version.name.inspect}" version.start_date = version.sprint_start_date version.save!