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

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

class AddGroupFileNameIndexToDependencyProxyManifests < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  NEW_INDEX = 'index_dependency_proxy_manifests_on_group_id_and_file_name'
  OLD_INDEX = 'index_dependency_proxy_manifests_on_group_id_and_digest'

  def up
    add_concurrent_index :dependency_proxy_manifests, [:group_id, :file_name], name: NEW_INDEX, unique: true
    remove_concurrent_index_by_name :dependency_proxy_manifests, OLD_INDEX
  end

  def down
    add_concurrent_index :dependency_proxy_manifests, [:group_id, :digest], name: OLD_INDEX
    remove_concurrent_index_by_name :dependency_proxy_manifests, NEW_INDEX
  end
end