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

20230627140707_async_index_for_vulnerabilities_uuid_type_migration.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cfca60eb02cfc86c470e21167038f783f83bc655 (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 AsyncIndexForVulnerabilitiesUuidTypeMigration < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  INDEX_NAME = "tmp_idx_vulns_on_converted_uuid"
  WHERE_CLAUSE = "uuid_convert_string_to_uuid = '00000000-0000-0000-0000-000000000000'::uuid"

  def up
    prepare_async_index(
      :vulnerability_occurrences,
      %i[id uuid_convert_string_to_uuid],
      name: INDEX_NAME,
      where: WHERE_CLAUSE
    )
  end

  def down
    unprepare_async_index(
      :vulnerability_occurrences,
      %i[id uuid_convert_string_to_uuid],
      name: INDEX_NAME
    )
  end
end