← hierarchy-data-closure-table
Update prefix_nodes_move_old_paths_after_update.sql
fix reference id.
+5 −2 · 1 file changed
-
sql/prefix_nodes_move_old_paths_after_update.sql+5 −2
@@ -9,7 +9,10 @@ CREATE TRIGGER `prefix_nodes_move_old_paths_after_update` AFTER UPDATE ON `prefix_nodes` FOR EACH ROW BEGIN IF OLD.`parent_id` != NEW.`parent_id` THEN - CALL p_prefix_nodes_move_old_paths_after_update(OLD.`parent_id`, NEW.`parent_id`); + //http://www.mysqlperformanceblog.com/2011/02/14/moving-subtrees-in-closure-table/ + //in the example, when change node D's parent to B. + //its sql has only D & B. so I think it should currentNode.id& newParent.id + CALL p_prefix_nodes_move_old_paths_after_update(NEW.`id`, NEW.`parent_id`); END IF; IF OLD.`is_deleted` != NEW.`is_deleted` THEN @@ -18,4 +21,4 @@ CREATE END; $$ -DELIMITER ; \ No newline at end of file +DELIMITER ;