From c4cc44528c4352d47c240403520bc8106152b0d3 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 23 Nov 2020 23:47:27 -0500 Subject: [PATCH] Fix error upgrading old databases after errors 5b9e6497af8 Creating missing tables breaks schema update steps that assume those tables don't exist, so we'll need another solution here. For now, disable the automatic integrity check and make a couple recent schema update steps more forgiving for people on the beta who already triggered this. --- chrome/content/zotero/xpcom/schema.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index b7b605a3ab..66ad6e4db8 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -2496,7 +2496,8 @@ Zotero.Schema = new function(){ } if (!options.skipIntegrityCheck) { - yield Zotero.Schema.integrityCheck(true); + // TEMP: Disabled + //yield Zotero.Schema.integrityCheck(true); } Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion); @@ -3115,7 +3116,10 @@ Zotero.Schema = new function(){ // what's going on. yield 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);"); - yield Zotero.DB.queryAsync("ALTER TABLE retractedItems ADD COLUMN flag INT DEFAULT 0"); + try { + yield Zotero.DB.queryAsync("ALTER TABLE retractedItems ADD COLUMN flag INT DEFAULT 0"); + } + catch (e) {} } else if (i == 106) { @@ -3145,7 +3149,7 @@ Zotero.Schema = new function(){ } else if (i == 109) { - yield Zotero.DB.queryAsync("CREATE TABLE dbDebug1 (\n a INTEGER PRIMARY KEY\n)"); + yield Zotero.DB.queryAsync("CREATE TABLE IF NOT EXISTS dbDebug1 (\n a INTEGER PRIMARY KEY\n)"); } else if (i == 110) {