From 26056c87f1d0b31dc56981adaabcab8fc2f85294 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 9 Aug 2018 03:30:47 -0400 Subject: [PATCH] Fix non-integer userID in settings table A submitted database had a text userID with a trailing "A0. Not sure how that happened -- it doesn't appear to be possible in current code -- but it caused group permissions not to be properly synced. --- chrome/content/zotero/xpcom/schema.js | 10 ++++++++++ resource/schema/userdata.sql | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 860274ce9b..511f912c66 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -2441,6 +2441,16 @@ Zotero.Schema = new function(){ } } + else if (i == 102) { + 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)); + } + } + } + // If breaking compatibility or doing anything dangerous, clear minorUpdateFrom } diff --git a/resource/schema/userdata.sql b/resource/schema/userdata.sql index 9685169fbe..dad8791a4e 100644 --- a/resource/schema/userdata.sql +++ b/resource/schema/userdata.sql @@ -1,4 +1,4 @@ --- 101 +-- 102 -- Copyright (c) 2009 Center for History and New Media -- George Mason University, Fairfax, Virginia, USA