您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

021_add_tracker_position.rb 291B

12345678910
  1. class AddTrackerPosition < ActiveRecord::Migration[4.2]
  2. def self.up
  3. add_column :trackers, :position, :integer, :default => 1
  4. Tracker.all.each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
  5. end
  6. def self.down
  7. remove_column :trackers, :position
  8. end
  9. end