diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-13 15:50:12 +0300 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2018-02-15 21:42:17 +0300 |
commit | 2ca4123c6e44aa3554d2db1bb8a32aa225eafa49 (patch) | |
tree | 293eccddfd0168ad6861e91de37dd8c719bbd2f1 /lib | |
parent | 8f74bb89cb0964c6cbf97a015c397c612cdeb22b (diff) |
Merge branch 'mk-fix-no-untracked-upload-files-error' into 'master'
Resolve "PrepareUntrackedUploads PostgreSQL syntax error"
Closes #42881
See merge request gitlab-org/gitlab-ce!17019
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/background_migration/prepare_untracked_uploads.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/background_migration/prepare_untracked_uploads.rb b/lib/gitlab/background_migration/prepare_untracked_uploads.rb index a7a1bbe1752..298de005b9b 100644 --- a/lib/gitlab/background_migration/prepare_untracked_uploads.rb +++ b/lib/gitlab/background_migration/prepare_untracked_uploads.rb @@ -43,7 +43,11 @@ module Gitlab store_untracked_file_paths - schedule_populate_untracked_uploads_jobs + if UntrackedFile.all.empty? + drop_temp_table + else + schedule_populate_untracked_uploads_jobs + end end private @@ -92,7 +96,7 @@ module Gitlab end end - yield(paths) + yield(paths) if paths.any? end def build_find_command(search_dir) @@ -165,6 +169,11 @@ module Gitlab bulk_queue_background_migration_jobs_by_range( UntrackedFile, FOLLOW_UP_MIGRATION) end + + def drop_temp_table + UntrackedFile.connection.drop_table(:untracked_files_for_uploads, + if_exists: true) + end end end end |