diff --git a/db/migrate/20161220141214_remove_dot_git_from_group_names.rb b/db/migrate/20161220141214_remove_dot_git_from_group_names.rb
index bd0e4b2cc07b8eb9fe2c45dd012afe2866becd4c..241afc6b097a415fd1efea879920b8fd7d392723 100644
--- a/db/migrate/20161220141214_remove_dot_git_from_group_names.rb
+++ b/db/migrate/20161220141214_remove_dot_git_from_group_names.rb
@@ -61,7 +61,7 @@ class RemoveDotGitFromGroupNames < ActiveRecord::Migration
   def move_namespace(group_id, path_was, path)
     repository_storage_paths = select_all("SELECT distinct(repository_storage) FROM projects WHERE namespace_id = #{group_id}").map do |row|
       Gitlab.config.repositories.storages[row['repository_storage']]
-    end
+    end.compact
 
     # Move the namespace directory in all storages paths used by member projects
     repository_storage_paths.each do |repository_storage_path|