Add detected_at column to vulnerability_occurrences table
What does this MR do and why?
This MR implements the database migration requested in issue #556251 (closed) to add the detected_at column to the vulnerability_occurrences table.
With the vulnerability_occurrences table acting as the primary record representing a vulnerability as it exists within a branch context, certain columns don't make sense in their place on the higher level vulnerabilities table and need to be moved down.
This migration adds:
detected_at timestamp with time zone DEFAULT now()
Database changes
- Adds
detected_atcolumn tovulnerability_occurrencestable - Uses
timestamptztype withnow()default - Follows GitLab migration patterns for large tables with
disable_ddl_transaction!andwith_lock_retries
How to set up and validate locally
- Run the migration:
bundle exec rails db:migrate - Verify the column exists:
bundle exec rails db:consoleand check the table schema - Test rollback:
bundle exec rails db:rollback
MR acceptance checklist
-
Database migration follows GitLab patterns -
Migration is reversible -
Uses appropriate column type and default value -
Includes proper rubocop disables for oversized table
Closes #556251 (closed)