debian-mirror-gitlab/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb
2023-03-17 16:20:25 +05:30

19 lines
541 B
Ruby

# 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