Delete child annotations when deleting attachment
And fix a FK definition that could result in orphaned `items` rows without `itemAnnotations` rows after an attachment was deleted.
This commit is contained in:
parent
0bc6b2ccc6
commit
76d504c564
3 changed files with 52 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
|||
-- 112
|
||||
-- 113
|
||||
|
||||
-- Copyright (c) 2009 Center for History and New Media
|
||||
-- George Mason University, Fairfax, Virginia, USA
|
||||
|
@ -127,7 +127,7 @@ CREATE TABLE itemAnnotations (
|
|||
position TEXT NOT NULL,
|
||||
isExternal INT NOT NULL,
|
||||
FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (parentItemID) REFERENCES itemAttachments(itemID) ON DELETE CASCADE
|
||||
FOREIGN KEY (parentItemID) REFERENCES itemAttachments(itemID)
|
||||
);
|
||||
CREATE INDEX itemAnnotations_parentItemID ON itemAnnotations(parentItemID);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue