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

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

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

  TABLE_NAME = :pages_deployments
  INDEX_NAME = 'index_pages_deployments_unique_path_prefix_by_project'

  def up
    add_text_limit TABLE_NAME, :path_prefix, 128
    add_text_limit TABLE_NAME, :build_ref, 512

    add_concurrent_index TABLE_NAME,
      [:project_id, :path_prefix],
      name: INDEX_NAME,
      unique: true
  end

  def down
    remove_text_limit TABLE_NAME, :path_prefix
    remove_text_limit TABLE_NAME, :build_ref

    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
  end
end