mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 13:58:49 +01:00
For whatever reason, the dynamic finders aren't available in this
migration and so the migration fails. Converting to find(:all,
:conditions => {...}) prevents this from not failing.
26 lines
783 B
Ruby
26 lines
783 B
Ruby
class SetNilTimestamps < ActiveRecord::Migration
|
|
|
|
class Project < ActiveRecord::Base; end
|
|
|
|
class Context < ActiveRecord::Base; end
|
|
|
|
def self.up
|
|
Project.find(:all, :conditions => { :created_at => nil }).each do |p|
|
|
Project.update( p.id, {:created_at => Time.now.utc} )
|
|
end
|
|
Project.find(:all, :conditions => { :created_at => nil }).each do |p|
|
|
Project.update( p.id, {:updated_at => Time.now.utc} )
|
|
end
|
|
Context.find(:all, :conditions => { :created_at => nil }).each do |p|
|
|
Context.update( p.id, {:created_at => Time.now.utc} )
|
|
end
|
|
Context.find(:all, :conditions => { :created_at => nil }).each do |p|
|
|
Context.update( p.id, {:updated_at => Time.now.utc} )
|
|
end
|
|
|
|
end
|
|
|
|
def self.down
|
|
#nothing to do here...
|
|
end
|
|
end
|