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

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

class AddSyncPartStep2OfIndexNamespacesOnPathForTopLevelNonProjects < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  TABLE_NAME = 'namespaces'
  INDEX_NAME = 'index_namespaces_on_path_for_top_level_non_projects'
  COLUMN = "lower((path)::text)"
  CONDITIONS = "(parent_id IS NULL AND type::text <> 'Project'::text)"

  def up
    add_concurrent_index TABLE_NAME, COLUMN, name: INDEX_NAME, where: CONDITIONS
  end

  def down
    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
  end
end