20130218141258_convert_closed_to_state_in_issue.rb 477 Bytes
Newer Older
Sean McGivern's avatar
Sean McGivern committed
1
# rubocop:disable all
2
class ConvertClosedToStateInIssue < ActiveRecord::Migration
3
  include Gitlab::Database::MigrationHelpers
4

5
  def up
6 7
    execute "UPDATE #{table_name} SET state = 'closed' WHERE closed = #{true_value}"
    execute "UPDATE #{table_name} SET state = 'opened' WHERE closed = #{false_value}"
8 9 10
  end

  def down
11 12 13 14 15 16 17
    execute "UPDATE #{table_name} SET closed = #{true_value} WHERE state = 'closed'"
  end

  private

  def table_name
    Issue.table_name
18 19
  end
end