Commit c77a353d authored by Michael Kozono's avatar Michael Kozono

Remove unnecessary clearing

Since duplicate inserts are now ignored.
parent 1807bc16
...@@ -17,7 +17,6 @@ module Gitlab ...@@ -17,7 +17,6 @@ module Gitlab
def perform def perform
return unless migrate? return unless migrate?
clear_untracked_file_paths
store_untracked_file_paths store_untracked_file_paths
schedule_populate_untracked_uploads_jobs schedule_populate_untracked_uploads_jobs
end end
...@@ -28,10 +27,6 @@ module Gitlab ...@@ -28,10 +27,6 @@ module Gitlab
UntrackedFile.table_exists? UntrackedFile.table_exists?
end end
def clear_untracked_file_paths
UntrackedFile.delete_all
end
def store_untracked_file_paths def store_untracked_file_paths
return unless Dir.exist?(UPLOAD_DIR) return unless Dir.exist?(UPLOAD_DIR)
......
...@@ -68,14 +68,14 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :migration, :side ...@@ -68,14 +68,14 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :migration, :side
# E.g. from a previous failed run of this background migration # E.g. from a previous failed run of this background migration
context 'when there is existing data in untracked_files_for_uploads' do context 'when there is existing data in untracked_files_for_uploads' do
before do before do
untracked_files_for_uploads.create(path: '/foo/bar.jpg') described_class.new.perform
end end
it 'does not error or produce duplicates of existing data' do it 'does not error or produce duplicates of existing data' do
Sidekiq::Testing.fake! do Sidekiq::Testing.fake! do
expect do expect do
described_class.new.perform described_class.new.perform
end.to change { untracked_files_for_uploads.count }.from(1).to(5) end.not_to change { untracked_files_for_uploads.count }.from(5)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment