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.
This commit is contained in:
Dan Stillman 2018-03-27 10:42:01 -04:00
parent 3db915516a
commit 3c5bc44ddf

View file

@ -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]);
}
}
}