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

20230726080827_add_issue_search_data_namespace_id_foreign_key.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43b4db7d9b565d1a166d0c14faabb3d8b9f67be6 (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
# frozen_string_literal: true

# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class AddIssueSearchDataNamespaceIdForeignKey < Gitlab::Database::Migration[2.1]
  include Gitlab::Database::PartitioningMigrationHelpers

  disable_ddl_transaction!

  INDEX_NAME = 'index_issue_search_data_on_namespace_id'

  def up
    add_concurrent_partitioned_index :issue_search_data, :namespace_id, name: INDEX_NAME
    add_concurrent_partitioned_foreign_key :issue_search_data, :namespaces,
      column: :namespace_id,
      on_delete: :cascade
  end

  def down
    remove_foreign_key_if_exists :issue_search_data, column: :namespace_id
    remove_concurrent_partitioned_index_by_name :issue_search_data, INDEX_NAME
  end
end