summaryrefslogtreecommitdiffstats
path: root/db/migrate/20141029181824_remove_issue_statuses_is_default.rb
blob: 62785d37a06a46c8028f233ae80cd3662c77f388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
class RemoveIssueStatusesIsDefault < ActiveRecord::Migration
  def up
    remove_column :issue_statuses, :is_default
  end

  def down
    add_column :issue_statuses, :is_default, :boolean, :null => false, :default => false
    # Restores the first status as default
    default_status_id = IssueStatus.order("position").pluck(:id).first
    IssueStatus.where(:id => default_status_id).update_all(:is_default => true)
  end
end