diff options
Diffstat (limited to 'lib/tasks/gitlab/check.rake')
-rw-r--r-- | lib/tasks/gitlab/check.rake | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 767674e1e84..071760c0c36 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -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 @@ -65,6 +66,7 @@ namespace :gitlab do puts "no".green else puts "yes".red + puts "Please fix this by removing the SQLite entry from the database.yml".blue for_more_information( "https://github.com/gitlabhq/gitlabhq/wiki/Migrate-from-SQLite-to-MySQL", see_database_guide @@ -181,6 +183,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? ... " @@ -727,7 +742,7 @@ namespace :gitlab do end def check_gitlab_shell - required_version = Gitlab::VersionInfo.new(1, 7, 9) + required_version = Gitlab::VersionInfo.new(1, 9, 1) current_version = Gitlab::VersionInfo.parse(gitlab_shell_version) print "GitLab Shell version >= #{required_version} ? ... " |