by descending post id

This commit is contained in:
Dylan Knutson
2025-08-13 08:18:47 +00:00
parent 6bb0b255fb
commit b33a267a83
13 changed files with 185 additions and 16 deletions

View File

@@ -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