Add new index for security_finding_enrichments
What does this MR do and why?
This MR adds a new index for security_finding_enrichments as suggested here
migration up
sec: == [advisory_lock_connection] object_id: 134460, pg_backend_pid: 38170
sec: == 20260216140431 AddCompositeIndexOnSecurityFindingEnrichments: migrating ====
sec: -- transaction_open?(nil)
sec: -> 0.0000s
sec: -- view_exists?(:postgres_partitions)
sec: -> 0.0266s
sec: -- index_exists?(:security_finding_enrichments, [:cve_enrichment_id, :id], {:name=>"index_security_finding_enrichments_on_cve_enrichment_id_and_id", :algorithm=>:concurrently})
sec: -> 0.0027s
sec: -- execute("SET statement_timeout TO 0")
sec: -> 0.0005s
sec: -- add_index(:security_finding_enrichments, [:cve_enrichment_id, :id], {:name=>"index_security_finding_enrichments_on_cve_enrichment_id_and_id", :algorithm=>:concurrently})
sec: -> 0.0020s
sec: -- execute("RESET statement_timeout")
sec: -> 0.0003s
sec: -- transaction_open?(nil)
sec: -> 0.0000s
sec: -- view_exists?(:postgres_partitions)
sec: -> 0.0003s
sec: -- index_name_exists?(:security_finding_enrichments, "index_sec_finding_enrichments_on_cve_enrichment_id")
sec: -> 0.0005s
sec: -- remove_index(:security_finding_enrichments, {:algorithm=>:concurrently, :name=>"index_sec_finding_enrichments_on_cve_enrichment_id"})
sec: -> 0.0020s
sec: == 20260216140431 AddCompositeIndexOnSecurityFindingEnrichments: migrated (0.0671s)
sec: == [advisory_lock_connection] object_id: 134460, pg_backend_pid: 38170
migration down
sec: -> 0.0005s
sec: -- add_index(:security_finding_enrichments, [:cve_enrichment_id, :id], {:name=>"index_security_finding_enrichments_on_cve_enrichment_id_and_id", :algorithm=>:concurrently})
sec: -> 0.0020s
sec: -- execute("RESET statement_timeout")
sec: -> 0.0003s
sec: -- transaction_open?(nil)
sec: -> 0.0000s
sec: -- view_exists?(:postgres_partitions)
sec: -> 0.0003s
sec: -- index_name_exists?(:security_finding_enrichments, "index_sec_finding_enrichments_on_cve_enrichment_id")
sec: -> 0.0005s
sec: -- remove_index(:security_finding_enrichments, {:algorithm=>:concurrently, :name=>"index_sec_finding_enrichments_on_cve_enrichment_id"})
sec: -> 0.0020s
sec: == 20260216140431 AddCompositeIndexOnSecurityFindingEnrichments: migrated (0.0671s)
sec: == [advisory_lock_connection] object_id: 134460, pg_backend_pid: 38170
marcosrocha@mrocha--20251201-KDPWL gitlab % bundle exec rake db:migrate:down:sec VERSION=20260216140431
sec: == [advisory_lock_connection] object_id: 134580, pg_backend_pid: 39445
sec: == 20260216140431 AddCompositeIndexOnSecurityFindingEnrichments: reverting ====
sec: -- transaction_open?(nil)
sec: -> 0.0000s
sec: -- view_exists?(:postgres_partitions)
sec: -> 0.0301s
sec: -- index_exists?(:security_finding_enrichments, [:cve_enrichment_id], {:name=>"index_sec_finding_enrichments_on_cve_enrichment_id", :algorithm=>:concurrently})
sec: -> 0.0032s
sec: -- execute("SET statement_timeout TO 0")
sec: -> 0.0005s
sec: -- add_index(:security_finding_enrichments, [:cve_enrichment_id], {:name=>"index_sec_finding_enrichments_on_cve_enrichment_id", :algorithm=>:concurrently})
sec: -> 0.0037s
sec: -- execute("RESET statement_timeout")
sec: -> 0.0004s
sec: -- transaction_open?(nil)
sec: -> 0.0000s
sec: -- view_exists?(:postgres_partitions)
sec: -> 0.0004s
sec: -- index_name_exists?(:security_finding_enrichments, "index_security_finding_enrichments_on_cve_enrichment_id_and_id")
sec: -> 0.0006s
sec: -- remove_index(:security_finding_enrichments, {:algorithm=>:concurrently, :name=>"index_security_finding_enrichments_on_cve_enrichment_id_and_id"})
sec: -> 0.0022s
sec: == 20260216140431 AddCompositeIndexOnSecurityFindingEnrichments: reverted (0.0787s)
sec: == [advisory_lock_connection] object_id: 134580, pg_backend_pid: 39445
References
Related to: !222681 (comment 3086479948)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Marcos Rocha