Skip to content

Add column to store external identifier ids on vulnerability_reads

Bala Kumar requested to merge 460080-db-include-identifiers-column into master

What does this MR do and why?

Part 1 MR (scope listed in #460080) to add the identifier_external_ids text array column to vulnerability_reads.

It is intended to be used for the filtering by identifier feature in #432419.

Database review

rake db:migrate:up:main
main: == [advisory_lock_connection] object_id: 127120, pg_backend_pid: 57816
main: == 20240610143108 AddIdentifierExternalIdsToVulnerabilityReads: migrating =====
main: -- add_column(:vulnerability_reads, :identifier_external_ids, :text, {:array=>true, :default=>[], :null=>false})
main:    -> 0.0013s
main: == 20240610143108 AddIdentifierExternalIdsToVulnerabilityReads: migrated (0.0044s)

main: == [advisory_lock_connection] object_id: 127120, pg_backend_pid: 57816
rake db:migrate:down:main
main: == [advisory_lock_connection] object_id: 127120, pg_backend_pid: 58689
main: == 20240610143108 AddIdentifierExternalIdsToVulnerabilityReads: reverting =====
main: -- remove_column(:vulnerability_reads, :identifier_external_ids, :text, {:array=>true, :default=>[], :null=>false})
main:    -> 0.0008s
main: == 20240610143108 AddIdentifierExternalIdsToVulnerabilityReads: reverted (0.0045s)

main: == [advisory_lock_connection] object_id: 127120, pg_backend_pid: 58689

How to set up and validate locally

  1. Should be able to run the migration locally.
  2. bundle exec rake db:migrate:up:main VERSION=20240610143108 and bundle exec rake db:migrate:down:main VERSION=20240610143108 and verify the column is created and dropped by inspecting in > gdk psql, > \d+ vulnerability_reads

Related to #460080

Edited by Bala Kumar

Merge request reports