Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fix the trigger for node paths in desktop
Hakan Shehu42ffc0509bd6
diff --git a/apps/desktop/src/main/data/workspace/migrations.ts b/apps/desktop/src/main/data/workspace/migrations.tsindex e4d4b45a..98418c66 100644--- a/apps/desktop/src/main/data/workspace/migrations.ts+++ b/apps/desktop/src/main/data/workspace/migrations.ts@@ -141,6 +141,10 @@ const createNodePathsTable: Migration = {AFTER INSERT ON nodesFOR EACH ROWBEGIN+ -- Insert direct path from the new node to itself+ INSERT INTO node_paths (ancestor_id, descendant_id, level)+ VALUES (NEW.id, NEW.id, 0);+-- Insert paths from ancestors to the new nodeINSERT INTO node_paths (ancestor_id, descendant_id, level)SELECT ancestor_id, NEW.id, level + 1@@ -153,7 +157,7 @@ const createNodePathsTable: Migration = {CREATE TRIGGER trg_update_node_pathAFTER UPDATE ON nodesFOR EACH ROW- WHEN OLD.parent_id IS DISTINCT FROM NEW.parent_id+ WHEN OLD.parent_id <> NEW.parent_idBEGIN-- Delete old paths involving the updated nodeDELETE FROM node_paths