summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-23 03:28:55 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-23 03:28:55 +0200
commitd9e95bdb6436768c738539df74a164c885887174 (patch)
tree47b0c461194f3cc9a3194b570f4e077eeccba011 /lib/tasks
parentdd40bce5ff080885e017709325fb49e9ccd55655 (diff)
Add action_participants, recording every node a trash/destroy touches
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/node_actions.rake14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/tasks/node_actions.rake b/lib/tasks/node_actions.rake
index fdd286c1..c378db24 100644
--- a/lib/tasks/node_actions.rake
+++ b/lib/tasks/node_actions.rake
@@ -58,4 +58,18 @@ namespace :node_actions do
58 58
59 puts "Created #{created} inferred entries" 59 puts "Created #{created} inferred entries"
60 end 60 end
61
62 desc "Backfill action_participants for existing single-subject entries. " \
63 "Idempotent: entries that already have a participant row are skipped. " \
64 "Multi-node trash/destroy entries predating this feature are NOT " \
65 "reconstructable (only a count was ever stored) and are left as-is."
66 task :backfill_participants => :environment do
67 scope = NodeAction.where.missing(:action_participants).where.not(:node_id => nil)
68 created = 0
69 scope.find_each do |action|
70 action.action_participants.create!(:subject => action.node)
71 created += 1
72 end
73 puts "Created #{created} participant rows"
74 end
61end 75end