summaryrefslogtreecommitdiff
path: root/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
blob: bf7db2fb12b671847cd8fdd15d25936a31868109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# rubocop:disable all
class AddFastForwardOptionToProject < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false

  disable_ddl_transaction!

  def up
    # We put condition here because of a mistake we made a couple of years ago
    # see https://gitlab.com/gitlab-org/gitlab-ce/issues/39382#note_45716103
    unless column_exists?(:projects, :merge_requests_ff_only_enabled)
      add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false)
    end
  end

  def down
    if column_exists?(:projects, :merge_requests_ff_only_enabled)
      remove_column(:projects, :merge_requests_ff_only_enabled)
    end
  end
end