BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8fa53ce4
Commit
8fa53ce4
authored
Mar 18, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'check_orphaned_users_groups' into 'master'
Check Orphaned Users Groups
parents
11f20576
5e7e814e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
check.rake
lib/tasks/gitlab/check.rake
+14
-0
No files found.
lib/tasks/gitlab/check.rake
View file @
8fa53ce4
...
...
@@ -17,6 +17,7 @@ namespace :gitlab do
check_database_config_exists
check_database_is_not_sqlite
check_migrations_are_up
check_orphaned_users_groups
check_gitlab_config_exists
check_gitlab_config_not_outdated
check_log_writable
...
...
@@ -181,6 +182,19 @@ namespace :gitlab do
end
end
def
check_orphaned_users_groups
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
end
def
check_satellites_exist
print
"Projects have satellites? ... "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment