Updated migration 36 (checked in with the last changeset) to initialize existing completed projects with a reasonable completed_at date. If you've already migrated after updating to the last changeset, you can do the following:

rake db:migrate VERSION=35
 rake db:migrate
 
If not, you can just migrate normally. Thanks to lrbalt for the catch. Reclosing #550.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@579 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-08-29 02:05:17 +00:00
parent 6805b22945
commit c2ae4ab9b8

View file

@ -1,6 +1,14 @@
class AddProjectCompletedAtColumn < ActiveRecord::Migration
class Project < ActiveRecord::Base; end
def self.up
add_column :projects, :completed_at, :datetime
@projects = Project.find(:all)
@projects.select{ |project| project.state == 'completed'}.each do |project|
project.completed_at = project.updated_at
project.save
end
end
def self.down