From f4a8822ea70a21f24fd92098c0eb5225b3d60994 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 3 Oct 2008 19:33:59 +0000 Subject: [PATCH] Fix "constraint failed" error when trying to delete attachment with annotations/highlights --- chrome/content/zotero/xpcom/data/item.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 856de2d37..50a8ba811 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3218,7 +3218,9 @@ Zotero.Item.prototype.erase = function(deleteChildren) { //Zotero.Fulltext.clearItemContent(this.id); } - + + Zotero.DB.query('DELETE FROM annotations WHERE itemID=?', this.id); + Zotero.DB.query('DELETE FROM highlights WHERE itemID=?', this.id); Zotero.DB.query('DELETE FROM itemCreators WHERE itemID=?', this.id); Zotero.DB.query('DELETE FROM itemNotes WHERE itemID=?', this.id); Zotero.DB.query('DELETE FROM itemAttachments WHERE itemID=?', this.id); @@ -3227,8 +3229,6 @@ Zotero.Item.prototype.erase = function(deleteChildren) { Zotero.DB.query('DELETE FROM itemTags WHERE itemID=?', this.id); Zotero.DB.query('DELETE FROM itemData WHERE itemID=?', this.id); Zotero.DB.query('DELETE FROM items WHERE itemID=?', this.id); - Zotero.DB.query('DELETE FROM annotations WHERE itemID=?', this.id); - Zotero.DB.query('DELETE FROM highlights WHERE itemID=?', this.id); try { Zotero.DB.commitTransaction();