by descending post id
This commit is contained in:
18
rake/fa.rake
18
rake/fa.rake
@@ -288,4 +288,22 @@ namespace :fa do
|
||||
Tasks::Fa::MigrateFaUserPostFavs.new.run_for_posts(start_at:, batch_size:)
|
||||
end
|
||||
end
|
||||
|
||||
desc "Backfill posted_at for FaPosts from url_str"
|
||||
task backfill_posted_at_from_url_str: :environment do
|
||||
progress = ProgressBar.create(total: nil, format: "%t: %c/%C %B %p%% %a %e")
|
||||
Domain::Post::FaPost
|
||||
.where(posted_at: nil)
|
||||
.includes(:files)
|
||||
.find_in_batches(batch_size: 100) do |batch|
|
||||
ReduxApplicationRecord.transaction do
|
||||
batch.each do |post|
|
||||
if (posted_at = post.posted_at)
|
||||
post.update(posted_at:)
|
||||
progress.increment
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user