20130218141344_convert_closed_to_state_in_milestone.rb 374 Bytes
Newer Older
1 2 3
class ConvertClosedToStateInMilestone < ActiveRecord::Migration
  def up
    Milestone.transaction do
Andrew8xx8's avatar
Andrew8xx8 committed
4 5
      Milestone.where(closed: false).update_all("state = 'opened'")
      Milestone.where(closed: false).update_all("state = 'active'")
6 7 8 9 10
    end
  end

  def down
    Milestone.transaction do
Andrew8xx8's avatar
Andrew8xx8 committed
11
      Milestone.where(state: :closed).update_all("closed = 1")
12 13 14
    end
  end
end