-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Description
I'm using active import to import comment trees. Is there any way to create the ancestry tree during the import (when the primary key id is not created yet)?
Currently, I'm importing all the comments, then looping through each comment to add the parent, and it is very slow even with indexes:
comments_to_import = []
import_data.each do |comment|
comments_to_import << Comment.new(is_parent: comment.parent_uuid.nil?, uuid: comment.uuid, parent_uuid: comment.parent_uuid, body: comment.body)
end
Comment.import comments_to_import
# build comment tree
Comment.where(is_parent: false, ancestry: nil).all.each do |c|
parent = Comment.find_by(uuid: c.parent_uuid)
c.update(parent: parent)
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels