Prevent removal of only organization owner
What does this MR do and why?
A product constraint exists that an Organization must have at least one owner. In !146284 (merged) we prevented removing the last organization owner when the organization membership was removed. In this MR we prevent User deletion when this would result in an Organization not having an owner.
DB Query Plan
Query plan for User#solo_owned_organizations
: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/28363/commands/88628
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #448992 (closed)
Edited by Alex Pooley