Commit 4aa3ce75342f26be3c87ac8c84f24658b9ef22a4
1 parent
17a9ecf8
Exists in
spb-stable
and in
3 other branches
Add check for orphaned UsersGroups
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
lib/tasks/gitlab/check.rake
... | ... | @@ -17,6 +17,7 @@ namespace :gitlab do |
17 | 17 | check_database_config_exists |
18 | 18 | check_database_is_not_sqlite |
19 | 19 | check_migrations_are_up |
20 | + check_orphaned_users_groups | |
20 | 21 | check_gitlab_config_exists |
21 | 22 | check_gitlab_config_not_outdated |
22 | 23 | check_log_writable |
... | ... | @@ -181,6 +182,15 @@ namespace :gitlab do |
181 | 182 | end |
182 | 183 | end |
183 | 184 | |
185 | + def check_orphaned_users_groups | |
186 | + print "Database contains orphaned UsersGroups? ... " | |
187 | + if UsersGroup.where("user_id not in (select id from users)").count > 0 | |
188 | + puts "yes".red | |
189 | + else | |
190 | + puts "no".green | |
191 | + end | |
192 | + end | |
193 | + | |
184 | 194 | def check_satellites_exist |
185 | 195 | print "Projects have satellites? ... " |
186 | 196 | ... | ... |