Skip to content

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 the forked_from_project relation.
  • Update the way we determine if a project is a fork in Project
  • Update the Projects::ForkService to only handle finding a ForkNetwork or 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_source method to jump directly to the ForkNetwork#root_project instead of looping through Project#forked_from_project
  • Revisit API endpoints, especially /projects/:id/fork/:id, because it seems it doesn't use the ForkNetworkMember model.
  • Since version 11.0 we removed API v3 and we can refactor ForksCountService in behalf of ForkNetworkMember. In API v3, the fork endpoint blocked the use of this model.

/cc @DouweM

Edited by Francisco Javier López