0
0
Fork 0

Add embed_url to preview cards (#5775)

This commit is contained in:
Akihiko Odaki 2017-12-07 11:37:43 +09:00 committed by Eugen Rochko
parent 432761f375
commit c083816c24
7 changed files with 38 additions and 9 deletions

View file

@ -326,5 +326,17 @@ namespace :mastodon do
end
end
end
desc 'Migrate photo preview cards made before 2.1'
task migrate_photo_preview_cards: :environment do
status_ids = Status.joins(:preview_cards)
.where(preview_cards: { embed_url: '', type: :photo })
.reorder(nil)
.group(:id)
.pluck(:id)
PreviewCard.where(embed_url: '', type: :photo).delete_all
LinkCrawlWorker.push_bulk status_ids
end
end
end