2007-02-01 00:18:43 +03:00
|
|
|
class AddTrackerPosition < ActiveRecord::Migration
|
|
|
|
def self.up
|
2007-10-23 01:07:13 +04:00
|
|
|
add_column :trackers, :position, :integer, :default => 1
|
2007-02-01 00:18:43 +03:00
|
|
|
Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
remove_column :trackers, :position
|
|
|
|
end
|
|
|
|
end
|