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

pull/6827/head
Jens Ulferts 14 years ago
parent e5b7ff6343
commit d51ab9d8cb
  1. 6
      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!

Loading…
Cancel
Save