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:
- Any new instance wide integration has org_id set !186439 (merged) (project/group integrations had foreign key set already)
- 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
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Create an instane wide integration (e.g. Jira Issues one)
- Create a new group
- Validate group is created successfully
- Go to group integrations and verify integration is inherited from instance wide integration
- Within group integrations - create a new group wide integration
- Create project within a group
- Verify project has inherited group and instance integrations
- Create project wide integration
- 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.