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

20230104222438_add_partition_index_to_builds_metadata.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 474f6f8540b628b292f299d742bcb8d881701deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class AddPartitionIndexToBuildsMetadata < Gitlab::Database::Migration[2.1]
  include Gitlab::Database::PartitioningMigrationHelpers

  disable_ddl_transaction!

  INDEX_NAME = 'p_ci_builds_metadata_on_runner_machine_id_idx'

  def up
    add_concurrent_partitioned_index :p_ci_builds_metadata, :runner_machine_id, name: INDEX_NAME,
      where: 'runner_machine_id IS NOT NULL'
  end

  def down
    remove_concurrent_partitioned_index_by_name :p_ci_builds_metadata, INDEX_NAME
  end
end