From 351d904dbeb16fa48415052aa3ae99206830c0a4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 26 Nov 2009 06:44:10 +0000 Subject: [PATCH] Modifying a standalone note would remove it from any collections it was in (since 2.0b7.5) --- triggers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/triggers.sql b/triggers.sql index 8f61e5ac4..90eee6814 100644 --- a/triggers.sql +++ b/triggers.sql @@ -1,4 +1,4 @@ --- 13 +-- 14 -- Triggers to validate date field DROP TRIGGER IF EXISTS insert_date_field; @@ -283,7 +283,7 @@ CREATE TRIGGER fku_itemAttachments_sourceItemID_collectionItems_itemID DROP TRIGGER IF EXISTS fku_itemNotes_sourceItemID_collectionItems_itemID; CREATE TRIGGER fku_itemNotes_sourceItemID_collectionItems_itemID BEFORE UPDATE OF sourceItemID ON itemNotes - FOR EACH ROW BEGIN + FOR EACH ROW WHEN OLD.sourceItemID IS NULL AND NEW.sourceItemID IS NOT NULL BEGIN DELETE FROM collectionItems WHERE itemID = NEW.itemID; END;