021_add_tracker_position.rb 291 Bytes
Newer Older
1
class AddTrackerPosition < ActiveRecord::Migration[4.2]
2
  def self.up
3
    add_column :trackers, :position, :integer, :default => 1
jplang's avatar
jplang committed
4
    Tracker.all.each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
5 6 7 8 9 10
  end

  def self.down
    remove_column :trackers, :position
  end
end