Skip to content

Remove inconsistent index

charlie ablett requested to merge 296756-cablett-remove-index into master

What does this MR do?

This index was committed to the codebase on a backup table. It resulted in the index on gitlab.com not being consistent with the structure.sql entry in the codebase.

This table will be removed with #227753 (closed), as it follows a complex data migration regarding deduplication of labels. It's good to have the actual database match our schema though 😅

Related to #296756 (closed)

Migrations

$ bundle exec rake db:migrate:up VERSION=20210203002331
== 20210203002331 DropBackupLabelIndex: migrating =============================
-- transaction_open?()
   -> 0.0000s
-- indexes(:backup_labels)
   -> 0.0033s
-- execute("SET statement_timeout TO 0")
   -> 0.0001s
-- remove_index(:backup_labels, {:algorithm=>:concurrently, :name=>"backup_labels_project_id_title_idx"})
   -> 0.0053s
-- execute("RESET ALL")
   -> 0.0002s
== 20210203002331 DropBackupLabelIndex: migrated (0.0092s) ====================
$ bundle exec rake db:migrate:down VERSION=20210203002331
== 20210203002331 DropBackupLabelIndex: reverting =============================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:backup_labels, [:project_id, :title], {:name=>"backup_labels_project_id_title_idx", :unique=>true, :where=>"group_id = NULL::integer", :algorithm=>:concurrently})
   -> 0.0026s
-- execute("SET statement_timeout TO 0")
   -> 0.0001s
-- add_index(:backup_labels, [:project_id, :title], {:name=>"backup_labels_project_id_title_idx", :unique=>true, :where=>"group_id = NULL::integer", :algorithm=>:concurrently})
   -> 0.0161s
-- execute("RESET ALL")
   -> 0.0003s
== 20210203002331 DropBackupLabelIndex: reverted (0.0194s) ====================

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #296756 (closed)

Edited by Mayra Cabrera

Merge request reports