Fix startup errors due to missed schema update steps for retractedItems
I don't know how this is happening -- people are ending up with an updated DB version but missing schema changes, despite the DB version being updated after the schema updates and in the same transaction -- but until we figure it out, apply the schema update steps in Zotero.Retractions.init() if necessary.
This commit is contained in:
parent
768ceda881
commit
1968d75814
2 changed files with 9 additions and 0 deletions
|
@ -48,6 +48,14 @@ Zotero.Retractions = {
|
|||
return;
|
||||
}
|
||||
|
||||
// TEMP: Until we can figure out why some schema updates aren't going through despite the
|
||||
// version number being incremented, create table here if it's missing
|
||||
await Zotero.DB.queryAsync("CREATE TABLE IF NOT EXISTS retractedItems (\n itemID INTEGER PRIMARY KEY,\n data TEXT,\n FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE\n);");
|
||||
try {
|
||||
await Zotero.DB.queryAsync("ALTER TABLE retractedItems ADD COLUMN flag INT DEFAULT 0");
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
// Load mappings of keys (DOI hashes and PMIDs) to items and vice versa and register for
|
||||
// item changes so they can be kept up to date in notify().
|
||||
await this._cacheKeyMappings();
|
||||
|
|
|
@ -2513,6 +2513,7 @@ Zotero.Schema = new function(){
|
|||
}
|
||||
}
|
||||
|
||||
// Duplicated in retractions.js::init() due to undiagnosed schema update bug
|
||||
else if (i == 105) {
|
||||
// This was originally in 103 and then 104, but some schema update steps are being
|
||||
// missed for some people, so run again with IF NOT EXISTS until we figure out
|
||||
|
|
Loading…
Reference in a new issue