Blob entry migration util

This commit is contained in:
Dylan Knutson
2023-05-18 20:12:10 -07:00
parent 1e4a3905f5
commit 52320955b3
7 changed files with 946 additions and 7 deletions

View File

@@ -37,10 +37,17 @@ end
namespace :blob_entries do
task :export_samples => :environment do
limit = ENV["limit"]&.to_i || raise("need 'limit' (num)")
out = ENV["out"] || raise("need 'out' (file path, .json encoded)")
BlobEntrySampleExporter.new.export_samples(limit, out)
outfile = ENV["outfile"] || raise("need 'outfile' (file path, .json encoded)")
BlobEntrySampleExporter.new.export_samples(limit, outfile)
end
task :import_samples => :environment do
infile = ENV["infile"] || raise("need 'infile' (file path, .json encoded)")
BlobEntrySampleExporter.new.import_samples(infile)
end
task :migrate_entries => :environment do
start_at = ENV["start_at"]
batch_size = ENV["batch_size"]&.to_i || 64
BlobEntrySampleExporter.new.migrate_blob_entries(start_at, batch_size)
end
end