From 3c5bc44ddf5c1dd11a5141b463779d507c411c28 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 27 Mar 2018 10:42:01 -0400 Subject: [PATCH] Fix potential upgrade error from c96363746b If a related item was defined using both an old userID and the current one, the schema upgrade step could fail. --- chrome/content/zotero/xpcom/schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 51261d0366..bb2a31514d 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -2424,7 +2424,7 @@ Zotero.Schema = new function(){ if (matches) { // Wrong libraryID if (matches[1] != userID) { - yield Zotero.DB.queryAsync(`UPDATE itemRelations SET object='http://zotero.org/users/${userID}/items/${matches[2]}' WHERE itemID=? AND predicateID=?`, [row.itemID, predicateID]); + yield Zotero.DB.queryAsync(`UPDATE OR REPLACE itemRelations SET object='http://zotero.org/users/${userID}/items/${matches[2]}' WHERE itemID=? AND predicateID=?`, [row.itemID, predicateID]); } } }