Add not null contraint to requirements.issue_id with validate: false
What does this MR do and why?
First step to add not null constraint to requirements.issue_id column
- Reschedule background migration to populate
requirements.issue_idwhen nil. There are no invalid records on production, but it may not be the case on self managed. - Add NOT NULL constraint to
requirements.issue_idcolumn withvalidate: false.
related to #348188 (closed)
Migration output
== 20220506123922 SchedulePopulateRequirementsIssueId: migrating ==============
-- Scheduled 0 MigrateRequirementsToWorkItems jobs with a maximum of 30 records per batch and an interval of 120 seconds.
The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2022-05-06 17:07:26 UTC."
== 20220506123922 SchedulePopulateRequirementsIssueId: migrated (0.0078s) =====
== 20220506124021 AddNotNullConstraintWithoutValidationToRequirementsIssueId: migrating
-- current_schema()
-> 0.0002s
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0003s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE requirements\nADD CONSTRAINT check_ac19122290\nCHECK ( issue_id IS NOT NULL )\nNOT VALID;\n")
-> 0.0006s
== 20220506124021 AddNotNullConstraintWithoutValidationToRequirementsIssueId: migrated (0.0082s)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Felipe Cardozo