mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-25 16:03:48 +00:00

Enables frozen string for the following files: * lib/generators/**/*.rb * lib/gitaly/**/*.rb * lib/google_api/**/*.rb * lib/haml_lint/**/*.rb * lib/json_web_token/**/*.rb * lib/mattermost/**/*.rb * lib/microsoft_teams/**/*.rb * lib/object_storage/**/*.rb * lib/omni_auth/**/*.rb * lib/peek/**/*.rb * lib/rouge/**/*.rb * lib/rspec_flaky/**/*.rb * lib/system_check/**/*.rb Partially addresses #47424.
23 lines
645 B
Ruby
23 lines
645 B
Ruby
# frozen_string_literal: true
|
|
|
|
module SystemCheck
|
|
module App
|
|
class OrphanedGroupMembersCheck < SystemCheck::BaseCheck
|
|
set_name 'Database contains orphaned GroupMembers?'
|
|
set_check_pass 'no'
|
|
set_check_fail 'yes'
|
|
|
|
def check?
|
|
!GroupMember.where('user_id not in (select id from users)').exists?
|
|
end
|
|
|
|
def show_error
|
|
try_fixing_it(
|
|
'You can delete the orphaned records using something along the lines of:',
|
|
sudo_gitlab("bundle exec rails runner -e production 'GroupMember.where(\"user_id NOT IN (SELECT id FROM users)\").delete_all'")
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|