"Fossies" - the Fresh Open Source Software Archive

Member "redmine-4.0.4/db/migrate/021_add_tracker_position.rb" (10 Jun 2019, 291 Bytes) of package /linux/www/redmine-4.0.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "021_add_tracker_position.rb": 3.4.7_vs_4.0.0.

    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 
    7   def self.down
    8     remove_column :trackers, :position
    9   end
   10 end