20130218141258_convert_closed_to_state_in_issue.rb 349 Bytes
Newer Older
1 2 3
class ConvertClosedToStateInIssue < ActiveRecord::Migration
  def up
    Issue.transaction do
Andrew8xx8's avatar
Andrew8xx8 committed
4 5
      Issue.where(closed: true).update_all("state = 'closed'")
      Issue.where(closed: false).update_all("state = 'opened'")
6 7 8 9 10
    end
  end

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