diff options
Diffstat (limited to 'db/post_migrate/20230705150100_recreate_type_migration_index_on_vulnerability_occurrences.rb')
-rw-r--r-- | db/post_migrate/20230705150100_recreate_type_migration_index_on_vulnerability_occurrences.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/post_migrate/20230705150100_recreate_type_migration_index_on_vulnerability_occurrences.rb b/db/post_migrate/20230705150100_recreate_type_migration_index_on_vulnerability_occurrences.rb new file mode 100644 index 00000000000..9e426c61874 --- /dev/null +++ b/db/post_migrate/20230705150100_recreate_type_migration_index_on_vulnerability_occurrences.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class RecreateTypeMigrationIndexOnVulnerabilityOccurrences < 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 + add_concurrent_index( + :vulnerability_occurrences, + %i[id uuid_convert_string_to_uuid], + name: INDEX_NAME, + where: WHERE_CLAUSE + ) + end + + def down + remove_concurrent_index_by_name( + :vulnerability_occurrences, + INDEX_NAME + ) + end +end |