Skip to content

Add NOT NULL constraint to merge_request_context_commits.merge_request_id

As part of &12795 we need to add sharding keys to all our tables. merge_request_context_commits already has merge_request_id from way-back, however sharding keys are required to be NOT NULL so we will need to embark on the multi-release process of migrating that column, as outlined here: https://docs.gitlab.com/ee/development/database/not_null_constraints.html#add-a-not-null-constraint-to-an-existing-column

By not having this column as NOT NULL we're unable to use desired_sharding_key to automatically backfill this table.

This will delay completion of adding sharding keys to tables that want to backfill their own sharding keys from merge_request_context_commits.

Similar to #444222 (closed)

Edited by Kerri Miller