[openstreetmap/openstreetmap-website] Backfill note subscriptions (PR #5304)
Anton Khorev
notifications at github.com
Fri Nov 8 07:34:16 UTC 2024
@AntonKhorev 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]
Moved `attrs = ...` outside, but I don't expect any difference about this compared to db reads/writes.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5304#discussion_r1833835585
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5304/review/2422900988 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241107/831f8bdd/attachment-0001.htm>
More information about the rails-dev
mailing list