summaryrefslogtreecommitdiff
path: root/db/post_migrate/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects.rb
blob: f31471c289141ce2f7f2e3702483c914dd721246 (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
26
27
# frozen_string_literal: true

# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class DropMergeRequestsRequireCodeOwnerApprovalFromProjects < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    remove_column :projects, :merge_requests_require_code_owner_approval, :boolean
  end

  def down
    add_column :projects, :merge_requests_require_code_owner_approval, :boolean # rubocop:disable Migration/AddColumnsToWideTables

    add_concurrent_index(
      :projects,
      %i[archived pending_delete merge_requests_require_code_owner_approval],
      name: 'projects_requiring_code_owner_approval',
      where: '((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))'
    )
  end
end