Skip to content

Add a foreign key to `merge_requests.head_pipeline_id`

What does this MR do?

This MR adds a foreign key to merge_requests.head_pipeline_id.

Are there points in the code the reviewer needs to double check?

We already have an index on that field, so it should be easier to add a foreign key. However adding this foreign key will introduce locking on ci_pipelines table, which is heavily used, and this might cause problems in case of running this migration when Sidekiq nodes are running.

What are the relevant issue numbers?

Closes gitlab-org/gitlab-ce#34065

Edited by Grzegorz Bizon

Merge request reports