Add NOT NULL constraint to user_id column in identities table

Add NOT NULL constraint to user_id in identities table

Problem

The user_id column in the identities table needs to be set as NOT NULL to support sharding key implementation. Currently, the column allows NULL values, which prevents proper sharding functionality.

Current State

The identities table has a user_id column that:

  • Is of type bigint
  • Allows NULL values
  • Has an index (index_identities_on_user_id)
  • Is exclusively owned by user

Proposed Change

Add a NOT NULL constraint to the user_id column in the identities table to enable proper sharding key implementation for the gitlab_main_user shard.

Technical Details

  • Table: identities
  • Column: user_id
  • Required Change: Add NOT NULL constraint

Additional Context

This change is necessary for implementing sharding functionality and has been validated by maintainers.

Edited by 🤖 GitLab Bot 🤖