Skip to content

Validate work_item_type_id is NOT NULL for new issue records

Mario Celi requested to merge 338003-not-null-work-item-type into master

What does this MR do and why?

We need to make sure no issues are created without associating them with a work item type first. We will validate the constraint after backfilling existing records

Related to #338003 (closed)

Migration Output

UP

== 20220414161654 AddNotNullConstraintToIssuesWorkItemType: migrating =========
-- current_schema()
   -> 0.0009s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE issues\nADD CONSTRAINT check_2addf801cd\nCHECK ( work_item_type_id IS NOT NULL )\nNOT VALID;\n")
   -> 0.0015s
== 20220414161654 AddNotNullConstraintToIssuesWorkItemType: migrated (0.0206s)

DOWN

== 20220414161654 AddNotNullConstraintToIssuesWorkItemType: reverting =========
-- transaction_open?()
   -> 0.0000s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE issues\nDROP CONSTRAINT IF EXISTS check_2addf801cd\n")
   -> 0.0019s
== 20220414161654 AddNotNullConstraintToIssuesWorkItemType: reverted (0.0104s)

MR acceptance checklist

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

Edited by Mario Celi

Merge request reports

Loading