[openstreetmap/openstreetmap-website] Backfill note subscriptions (PR #5304)
Tom Hughes
notifications at github.com
Thu Nov 7 17:37:14 UTC 2024
@tomhughes commented on this pull request.
> @@ -0,0 +1,14 @@
+class BackfillNoteSubscriptions < ActiveRecord::Migration[7.2]
+ class NoteComment < ApplicationRecord; end
+ class NoteSubscription < ApplicationRecord; end
+
+ disable_ddl_transaction!
+
+ def up
+ NoteComment.in_batches(:of => 1000) do |note_comments|
+ rows = note_comments.distinct.where.not(:author_id => nil).pluck(:author_id, :note_id)
+ attrs = %w[user_id note_id]
There's no need to initialise this for every batch, it could go before the loop?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5304#pullrequestreview-2421727032
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5304/review/2421727032 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241107/2473b07e/attachment.htm>
More information about the rails-dev
mailing list