Drop UsersGroup orphans using rails runner
This commit is contained in:
parent
4aa3ce7534
commit
5e7e814e81
1 changed files with 4 additions and 0 deletions
|
@ -186,6 +186,10 @@ namespace :gitlab do
|
|||
print "Database contains orphaned UsersGroups? ... "
|
||||
if UsersGroup.where("user_id not in (select id from users)").count > 0
|
||||
puts "yes".red
|
||||
try_fixing_it(
|
||||
"You can delete the orphaned records using something along the lines of:",
|
||||
sudo_gitlab("bundle exec rails runner -e production 'UsersGroup.where(\"user_id NOT IN (SELECT id FROM users)\").delete_all'")
|
||||
)
|
||||
else
|
||||
puts "no".green
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue