Skip to content

Add not null constraint for releases.project_id

Tiger Watson requested to merge add-releases-project-id-not-null into master

What does this MR do and why?

Adds a NOT NULL constraint for releases.project_id. This is required because project_id is the sharding key for this table.

This is a non-optional association in the model, and there are no existing records on GitLab.com where this column is null (source).

So that we can be confident adding the constraint won't fail, we first delete any existing records that have no project_id. This is expected to be a no-op on all instances, as these records have always been created in the context of a project and don't make sense to exist without one (their existence wouldn't be visible to users).

MR acceptance checklist

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

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

#461972

Edited by Tiger Watson

Merge request reports