The foreign key was introduced in #514662 (closed).
https://docs.gitlab.com/development/database/add_foreign_key_to_existing_column/#add-a-migration-to-validate-the-fk-synchronously