Replace shard_id FK with LFK for snippet_repositories

What does this MR do and why?

Contributes to #575428 (closed)

Context

Previously NOT NULL constraint was removed from shard_id - !209700 (merged)

Problem

When an organization's PG data is moved from one cell to another, the snippet_repositories.shard_id will be nullified, to be set with a new shard_id that is applicable to the new cell.

Because snippet_repositories schema will be changed to gitlab_main_org, it leads to a cross-database foreign key failure for the shard_id foreign key constraint.

Solution

Replace FK with LFK for shard_id

Related to #575428 (closed)

Edited by Vasilii Iakliushin

Merge request reports

Loading