From 7700cd776aa18bcd8b5d04d2b2a9f3d3b6e363f8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 21 Feb 2022 15:06:15 -0500 Subject: [PATCH] Repeat itemAnnotations schema update step after 078e3bb079 --- chrome/content/zotero/xpcom/schema.js | 11 +++++++++++ resource/schema/userdata.sql | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index fbd60ef91c..75b943de49 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -3430,6 +3430,17 @@ Zotero.Schema = new function(){ await Zotero.DB.queryAsync("CREATE INDEX itemAnnotations_parentItemID ON itemAnnotations(parentItemID)"); } + else if (i == 120) { + // Repeat 119 if it didn't go through + if (!await Zotero.DB.columnExists('itemAnnotations', 'authorName')) { + await Zotero.DB.queryAsync("CREATE TABLE itemAnnotationsTemp (\n itemID INTEGER PRIMARY KEY,\n parentItemID INT NOT NULL,\n type INTEGER NOT NULL,\n authorName TEXT,\n text TEXT,\n comment TEXT,\n color TEXT,\n pageLabel TEXT,\n sortIndex TEXT NOT NULL,\n position TEXT NOT NULL,\n isExternal INT NOT NULL,\n FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE,\n FOREIGN KEY (parentItemID) REFERENCES itemAttachments(itemID)\n)"); + await Zotero.DB.queryAsync("INSERT INTO itemAnnotationsTemp SELECT itemID, parentItemID, type, '', text, comment, color, pageLabel, sortIndex, position, isExternal FROM itemAnnotations"); + await Zotero.DB.queryAsync("DROP TABLE itemAnnotations"); + await Zotero.DB.queryAsync("ALTER TABLE itemAnnotationsTemp RENAME TO itemAnnotations"); + await Zotero.DB.queryAsync("CREATE INDEX itemAnnotations_parentItemID ON itemAnnotations(parentItemID)"); + } + } + // If breaking compatibility or doing anything dangerous, clear minorUpdateFrom } diff --git a/resource/schema/userdata.sql b/resource/schema/userdata.sql index a4f824c0e6..dda3aa6953 100644 --- a/resource/schema/userdata.sql +++ b/resource/schema/userdata.sql @@ -1,4 +1,4 @@ --- 119 +-- 120 -- Copyright (c) 2009 Center for History and New Media -- George Mason University, Fairfax, Virginia, USA