Database: Add non nullable to column has_merge_request
We introduced column has_merge_request to vulnerability_reads table in !127329 (merged) but missed including null: false during the column creation.
It is not a breaking issue and for consistency with other existing columns in the table (has_issues) and to avoid confusions in future with respect to development we can also set null: false to that column.
Creating this issue to track this backlog debt.
Implementation plan
Referring DB not null constraint guidelines, since we already have the Model validation in place, the work left for this issue is:
- Confirm no records has a
nilvalue forhas_merge_requestin production. (If community contributors need help on this, can tag gitlab team members on the implementation MR) - Implement a post deployment migration like the below patch.
Proposal
+# frozen_string_literal: true
+
+class UpdateHasMergeRequestOnVulnerabilityReads < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint :vulnerability_reads, :has_merge_request
+ end
+
+ def down
+ remove_not_null_constraint :vulnerability_reads, :has_merge_request
+ end
+end
Edited by Bala Kumar