From 58f1a67ffda517125abdb4418b93bf6cee4b71f8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 29 Apr 2007 06:27:19 +0000 Subject: [PATCH] Recover orphaned notes that some people seem to have, though I'm not sure how they happened -- maybe due to the previous behavior of closing out incomplete transactions? --- chrome/content/zotero/xpcom/schema.js | 20 ++++++++++++++++++++ userdata.sql | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index ccf89f322..6c07f215c 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -1056,6 +1056,26 @@ Zotero.Schema = new function(){ if (i==32) { Zotero.DB.query("UPDATE itemData SET fieldID=100 WHERE itemID IN (SELECT itemID FROM items WHERE itemTypeID=20) AND fieldID=14;"); } + + if (i==33) { + var rows = Zotero.DB.query("SELECT * FROM itemNotes WHERE itemID NOT IN (SELECT itemID FROM items)"); + if (rows) { + var colID = Zotero.getRandomID('collections', 'collectionID'); + Zotero.DB.query("INSERT INTO collections VALUES (?,?,?)", [colID, "[Recovered Notes]", null]); + + for (var j=0; j