summaryrefslogtreecommitdiffstats
path: root/db/migrate/019_add_issue_status_position.rb
blob: 1c65e52e3c68e18881865b4446f127927877fec0 (plain)
1
2
3
4
5
6
7
8
9
10
class AddIssueStatusPosition < ActiveRecord::Migration
  def self.up
    add_column :issue_statuses, :position, :integer, :default => 1, :null => false
    IssueStatus.find(:all).each_with_index {|status, i| status.update_attribute(:position, i+1)}
  end

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