Cleaning up orphaned project registries

I think it should be a rake task that cleans orphaned registry records, something like @toon implemented for LFS https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14140. Also, see for details https://gitlab.com/gitlab-org/gitlab-ee/issues/11588

Since we have semi-reliable fetcher enabled by default the probability is low but still exists. Moreover, some orphaned registries could exist before that.

TODO:

  • Create a worker that iterates over projects and removes orphaned records
  • Create a rake task that spawns this worker
  • Spawn this worker in a background migration
Edited by Valery Sizov