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,6 +17,7 @@ namespace :gitlab do | ||
17 | check_database_config_exists | 17 | check_database_config_exists |
18 | check_database_is_not_sqlite | 18 | check_database_is_not_sqlite |
19 | check_migrations_are_up | 19 | check_migrations_are_up |
20 | + check_orphaned_users_groups | ||
20 | check_gitlab_config_exists | 21 | check_gitlab_config_exists |
21 | check_gitlab_config_not_outdated | 22 | check_gitlab_config_not_outdated |
22 | check_log_writable | 23 | check_log_writable |
@@ -181,6 +182,15 @@ namespace :gitlab do | @@ -181,6 +182,15 @@ namespace :gitlab do | ||
181 | end | 182 | end |
182 | end | 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 | def check_satellites_exist | 194 | def check_satellites_exist |
185 | print "Projects have satellites? ... " | 195 | print "Projects have satellites? ... " |
186 | 196 |