Skip to content

Resolve "Inconsistent schema - index_vulnerability_occurrences_deduplication index"

Diogo Frazão requested to merge 349549-inconsistent-schema-index-2 into master

What does this MR do and why?

The index index_vulnerability_occurrences_deduplication was added in this MR. For some, unknown reason we could not find it in our production database.

I am adding the index back to avoid inconsistency between our Gitlab.com and self-host databases.

up:

== 20220109134455 AddIdxVulnerabilityOccurrencesDedupAgain: migrating =========
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:vulnerability_occurrences, [:project_id, :report_type, :project_fingerprint], {:name=>"index_vulnerability_occurrences_deduplication", :algorithm=>:concurrently})
   -> 0.0085s
-- Index not created because it already exists (this may be due to an aborted migration or similar): table_name: vulnerability_occurrences, column_name: [:project_id, :report_type, :project_fingerprint]
== 20220109134455 AddIdxVulnerabilityOccurrencesDedupAgain: migrated (0.0108s)

down:

== 20220109134455 AddIdxVulnerabilityOccurrencesDedupAgain: reverting =========
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:vulnerability_occurrences, [:project_id, :report_type, :project_fingerprint], {:name=>"index_vulnerability_occurrences_deduplication", :algorithm=>:concurrently})
   -> 0.0055s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- remove_index(:vulnerability_occurrences, {:name=>"index_vulnerability_occurrences_deduplication", :algorithm=>:concurrently, :column=>[:project_id, :report_type, :project_fingerprint]})
   -> 0.0079s
-- execute("RESET statement_timeout")
   -> 0.0005s
== 20220109134455 AddIdxVulnerabilityOccurrencesDedupAgain: reverted (0.0211s)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #349549 (closed)

Edited by Diogo Frazão

Merge request reports