Add Gitlab::Database::Subquery.self_join to delete_all with limit
What does this MR do?
delete_all
doesn't support limit, so you'd need to subquery
that. And instead of subquerying with where(id: query)
, it's better
to use an INNER JOIN
. This method also works with MySQL, while
subquerying doesn't (without another layer of subquerying)
This is a backport of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6175
Edited by Toon Claes