summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
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 fdd286c..c378db2 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