summaryrefslogtreecommitdiff
path: root/db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
blob: 75bea41387cffec695787298ce191f88ff60476e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class AddEstimateToIssuablesCe < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    unless column_exists?(:issues, :time_estimate)
      add_column :issues, :time_estimate, :integer
    end

    unless column_exists?(:merge_requests, :time_estimate)
      add_column :merge_requests, :time_estimate, :integer
    end
  end

  def down
    if column_exists?(:issues, :time_estimate)
      remove_column :issues, :time_estimate
    end

    if column_exists?(:merge_requests, :time_estimate)
      remove_column :merge_requests, :time_estimate
    end
  end
end