Skip to content

Add present on default branch to author_id index

What does this MR do and why?

Describe in detail what your merge request does and why.

This Merge Request adds the present_on_default_branch attribute to the author_id index on the vulnerabilities table.

The present_on_default_branch field will be used on most queries, and the vulnerabilities indices should be rearranged.

More context can be found on this comment and this issue

This Merge Request is related to the issue #324858 (closed)

Migration Up

main: == 20220613211017 UpdateVulnerabilitiesAuthorIdIndex: migrating ===============
main: -- index_exists?(:vulnerabilities, [:author_id, :present_on_default_branch], {:name=>"index_vulnerabilities_author_id_and_present_on_default_branch", :algorithm=>:concurrently})
main:    -> 0.0113s
main: -- add_index_options(:vulnerabilities, [:author_id, :present_on_default_branch], {:name=>"index_vulnerabilities_author_id_and_present_on_default_branch", :algorithm=>:concurrently})
main:    -> 0.0002s
main: == 20220613211017 UpdateVulnerabilitiesAuthorIdIndex: migrated (0.0287s) ======

Migration Down

main: == 20220613211017 UpdateVulnerabilitiesAuthorIdIndex: reverting ===============
main: -- index_name(:vulnerabilities, "index_vulnerabilities_author_id_and_present_on_default_branch")
main:    -> 0.0000s
main: == 20220613211017 UpdateVulnerabilitiesAuthorIdIndex: reverted (0.0412s) ======

Query explanation

Before index
Time: 
After index
Time: 

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.

Edited by Marcos Rocha

Merge request reports