Remove the `ForkedProjectLink` model
After https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14422 the information in the forked_project_links table is duplicated in fork_networks and fork_network_members.
The new relations are being populated in background migrations, we need to double check that those are finished before we start removing ForkedProjectLink.
The migrations handling this are PopulateForkNetworksRange and CreateForkNetworkMembersRange.
We need to clean this up throughout the code:
- Remove the relation in
Project: When updating the relation, we need to pay attention to correctly handle theforked_from_projectrelation. - Update the way we determine if a project is a fork in
Project - Update the
Projects::ForkServiceto only handle finding aForkNetworkor creating one from the current project. - Lower the QueryCounter threshold in the
api/projects_spec.rb - Correctly find the LFS-objects for a forked project: https://gitlab.com/gitlab-org/gitlab-ce/issues/39769
- Update the
Project#fork_sourcemethod to jump directly to theForkNetwork#root_projectinstead of looping throughProject#forked_from_project - Revisit API endpoints, especially
/projects/:id/fork/:id, because it seems it doesn't use theForkNetworkMembermodel. - Since version 11.0 we removed API v3 and we can refactor
ForksCountServicein behalf ofForkNetworkMember. In API v3, the fork endpoint blocked the use of this model.
/cc @DouweM
Edited by Francisco Javier López