debian-mirror-gitlab/db/migrate/20200325183636_add_api_index_for_internal_projects.rb
2020-04-22 19:07:51 +05:30

22 lines
547 B
Ruby

# frozen_string_literal: true
class AddApiIndexForInternalProjects < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INTERNAL_PROJECTS_INDEX_NAME = "index_projects_api_created_at_id_for_vis10"
disable_ddl_transaction!
def up
add_concurrent_index :projects, [:created_at, :id],
where: "visibility_level = 10 AND pending_delete = false",
name: INTERNAL_PROJECTS_INDEX_NAME
end
def down
remove_concurrent_index_by_name :projects, INTERNAL_PROJECTS_INDEX_NAME
end
end