Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20200511115431_add_index_inherit_from_id_to_services.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a0a5f361edf0346894b3316582a9e36ab7bdc7ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class AddIndexInheritFromIdToServices < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :services, :inherit_from_id

    add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify
  end

  def down
    remove_foreign_key_if_exists :services, column: :inherit_from_id

    remove_concurrent_index :services, :inherit_from_id
  end
end