summaryrefslogtreecommitdiffstats
path: root/db/migrate/021_add_tracker_position.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-01-31 21:18:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-01-31 21:18:43 +0000
commitfa688d48e673abfa8711beb69995aaf3d41069d1 (patch)
treeb86c5494839673b615cb2d99aac8a861067fd10d /db/migrate/021_add_tracker_position.rb
parent671a0fa10161ead2ec0fef888710cf7d872b2f61 (diff)
downloadredmine-fa688d48e673abfa8711beb69995aaf3d41069d1.tar.gz
redmine-fa688d48e673abfa8711beb69995aaf3d41069d1.zip
added the ability to set the sort order for trackers
git-svn-id: http://redmine.rubyforge.org/svn/trunk@209 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate/021_add_tracker_position.rb')
-rw-r--r--db/migrate/021_add_tracker_position.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/021_add_tracker_position.rb b/db/migrate/021_add_tracker_position.rb
new file mode 100644
index 000000000..30a5d771c
--- /dev/null
+++ b/db/migrate/021_add_tracker_position.rb
@@ -0,0 +1,10 @@
+class AddTrackerPosition < ActiveRecord::Migration
+ def self.up
+ add_column :trackers, :position, :integer, :default => 1, :null => false
+ Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
+ end
+
+ def self.down
+ remove_column :trackers, :position
+ end
+end