mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-03 07:48:50 +01:00
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:
parent
6805b22945
commit
c2ae4ab9b8
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue