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

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

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

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :import_export_uploads, :namespaces, column: :group_id, on_delete: :cascade
    add_concurrent_index :import_export_uploads, :group_id, unique: true, where: 'group_id IS NOT NULL'
  end

  def down
    remove_foreign_key_without_error(:import_export_uploads, column: :group_id)
    remove_concurrent_index(:import_export_uploads, :group_id)
  end
end