Skip to content

Asynchronous validation of `finding_id` foreign key on vulnerabilities

What does this MR do and why?

Synchronous migration will be added in #425409 (closed)

How to set up and validate locally

  1. Test database FK changes locally

Migration Output

bundle exec rails db:migrate
~/gitlab-development-kit/gitlab$ bundle exec rails db:migrate
main: == [advisory_lock_connection] object_id: 183100, pg_backend_pid: 128883
main: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: migrating ==========
main: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: migrated (0.0037s) =

main: == [advisory_lock_connection] object_id: 183100, pg_backend_pid: 128883
ci: == [advisory_lock_connection] object_id: 183200, pg_backend_pid: 128885
ci: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: migrating ==========
ci: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: migrated (0.0081s) =

ci: == [advisory_lock_connection] object_id: 183200, pg_backend_pid: 128885
bundle exec rails db:rollback:ci
~/gitlab-development-kit/gitlab$ bundle exec rails db:rollback:ci
ci: == [advisory_lock_connection] object_id: 182380, pg_backend_pid: 129776
ci: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: reverting ==========
ci: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: reverted (0.0245s) =

ci: == [advisory_lock_connection] object_id: 182380, pg_backend_pid: 129776
bundle exec rails db:rollback:main
~/gitlab-development-kit/gitlab$ bundle exec rails db:rollback:main
main: == [advisory_lock_connection] object_id: 182440, pg_backend_pid: 129377
main: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: reverting ==========
main: == 20231225070431 AsyncValidateFindingIdOnVulnerabilities: reverted (0.0217s) =

main: == [advisory_lock_connection] object_id: 182440, pg_backend_pid: 129377

Screenshots

results of \d+ vulnerabilities before/after running migration locally

before after
image image

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #418972 (closed)

Edited by Michael Becker

Merge request reports

Loading