Skip to content

Remove tmp_index_approval_project_rules_scanners

What does this MR do?

Remove tmp_index_approval_project_rules_scanners from approval_project_rules table. It was added only to support a pos-deployment migration.

Related issue: #337776 (closed)

Before migration

Indexes:
    "approval_project_rules_pkey" PRIMARY KEY, btree (id)
    "any_approver_project_rule_type_unique_index" UNIQUE, btree (project_id) WHERE rule_type = 3
    "index_approval_project_rules_on_id_with_regular_type" btree (id) WHERE rule_type = 0
    "index_approval_project_rules_on_project_id" btree (project_id)
    "index_approval_project_rules_on_rule_type" btree (rule_type)
    "tmp_index_approval_project_rules_scanners" gin (scanners) WHERE scanners @> '{cluster_image_scanning}'::text[]

the Migration

$ bundle exec rails db:migrate
== 20210819152723 RemoveTmpIndexApprovalProjectRulesScanners: migrating =======
-- transaction_open?()
   -> 0.0000s
-- indexes(:approval_project_rules)
   -> 0.0077s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- remove_index(:approval_project_rules, {:algorithm=>:concurrently, :name=>"tmp_index_approval_project_rules_scanners"})
   -> 0.0043s
-- execute("RESET statement_timeout")
   -> 0.0005s
== 20210819152723 RemoveTmpIndexApprovalProjectRulesScanners: migrated (0.0148s)

After the Migration

Indexes:
    "approval_project_rules_pkey" PRIMARY KEY, btree (id)
    "any_approver_project_rule_type_unique_index" UNIQUE, btree (project_id) WHERE rule_type = 3
    "index_approval_project_rules_on_id_with_regular_type" btree (id) WHERE rule_type = 0
    "index_approval_project_rules_on_project_id" btree (project_id)
    "index_approval_project_rules_on_rule_type" btree (rule_type)

the Rollback

$ bundle exec rails db:rollback
== 20210819152723 RemoveTmpIndexApprovalProjectRulesScanners: reverting =======
== 20210819152723 RemoveTmpIndexApprovalProjectRulesScanners: reverted (0.0000s)

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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

Merge request reports