If userID is set, migrate any item relations with local user key

DB update to go along with 0d8643087a
This commit is contained in:
Dan Stillman 2017-03-02 01:31:38 -05:00
parent 0d8643087a
commit 3a5490a1ef
2 changed files with 8 additions and 1 deletions

View File

@ -2371,6 +2371,13 @@ Zotero.Schema = new function(){
else if (i == 91) {
yield Zotero.DB.queryAsync("ALTER TABLE libraries ADD COLUMN archived INT NOT NULL DEFAULT 0");
}
else if (i == 92) {
let userID = yield Zotero.DB.valueQueryAsync("SELECT value FROM settings WHERE setting='account' AND key='userID'");
if (userID) {
yield Zotero.DB.queryAsync("UPDATE itemRelations SET object='http://zotero.org/users/' || ? || SUBSTR(object, 39) WHERE object LIKE ?", [userID, 'http://zotero.org/users/local/%']);
}
}
}
yield _updateDBVersion('userdata', toVersion);

View File

@ -1,4 +1,4 @@
-- 91
-- 92
-- Copyright (c) 2009 Center for History and New Media
-- George Mason University, Fairfax, Virginia, USA