Add not null constraint on integrations table

What does this MR do and why?

This MR adds multiple not null constraint on integrations table to make sure one of group_id, project_id, organization_id is present when a new record is added. It's needed so that we can shard this table as part of Cells architecture. Please note that in the past we ensured that:

  1. Any new instance wide integration has org_id set !186439 (merged) (project/group integrations had foreign key set already)
  2. Any existing records are backfilled in !189808 (merged)

Which means we are ready to set a not null constraint.

Please note this MR was previously reverted !196867 (merged) because it caused staging incident due to groups/projects failing to be created when there is an active default instance integration present. As per the discussion below the not null constraint migration should have been added as a post deployment migration, which this MR updated. No other changes otherwise.

References

#524677 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Create an instane wide integration (e.g. Jira Issues one)
  2. Create a new group
  3. Validate group is created successfully
  4. Go to group integrations and verify integration is inherited from instance wide integration
  5. Within group integrations - create a new group wide integration
  6. Create project within a group
  7. Verify project has inherited group and instance integrations
  8. Create project wide integration
  9. Verify integration is created successfully

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by George Koltsov

Merge request reports

Loading