From 63d8d57f83dcb7f77eaf02e979cf8125eb172275 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 9 Aug 2018 03:39:16 -0400 Subject: [PATCH] Add userID fix to earlier schema update Since the userID is used in relations updates moving from Zotero 4 to 5 --- chrome/content/zotero/xpcom/schema.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 511f912c66..0eb2679fcb 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -1868,6 +1868,14 @@ Zotero.Schema = new function(){ if (i == 80) { yield _updateCompatibility(1); + let userID = yield Zotero.DB.valueQueryAsync("SELECT value FROM settings WHERE setting='account' AND key='userID'"); + if (userID && typeof userID == 'string') { + userID = userID.trim(); + if (userID) { + yield Zotero.DB.queryAsync("UPDATE settings SET value=? WHERE setting='account' AND key='userID'", parseInt(userID)); + } + } + // Delete 'libraries' rows not in 'groups', which shouldn't exist yield Zotero.DB.queryAsync("DELETE FROM libraries WHERE libraryID != 0 AND libraryID NOT IN (SELECT libraryID FROM groups)");