diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-13 15:50:12 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-13 15:50:12 +0300 |
commit | c133f1a7480d32641d48ca5f0c6155a5cbb89e89 (patch) | |
tree | 0f8492facdc19d63821a8eaec8e0b5c13954a177 /lib | |
parent | 41285af45d086ded796c6e05eed31890df69d825 (diff) | |
parent | 4e6a8eaab6004d789cab08e625478fe9d5ef2bb7 (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 |