debian-mirror-gitlab/db/migrate/20210901065504_add_index_on_name_and_id_to_public_groups.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
513 B
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
class AddIndexOnNameAndIdToPublicGroups < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_namespaces_public_groups_name_id'
PUBLIC_VISIBILITY_LEVEL = 20
disable_ddl_transaction!
def up
2022-08-27 11:52:29 +05:30
add_concurrent_index :namespaces, [:name, :id],
name: INDEX_NAME,
where: "type = 'Group' AND visibility_level = #{PUBLIC_VISIBILITY_LEVEL}"
2021-11-11 11:23:49 +05:30
end
def down
remove_concurrent_index_by_name :namespaces, INDEX_NAME
end
end