From a8d8909e2ea9860425661ed63d13b0839635d10b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 5 Feb 2008 11:15:53 +0000 Subject: [PATCH] Revert [1615-1616] on the trunk, where they're no longer necessary --- chrome/content/zotero/xpcom/schema.js | 45 ++------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index d40e7d640..0c7928959 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -38,8 +38,6 @@ Zotero.Schema = new function(){ var _repositoryTimer; var _remoteUpdateInProgress = false; - var _fulltextItemWordsCache = null; - var self = this; function userDataUpgradeRequired() { @@ -123,6 +121,7 @@ Zotero.Schema = new function(){ var up1 = _migrateUserDataSchema(dbVersion); var up2 = _updateSchema('system'); + var up3 = _updateSchema('scrapers'); Zotero.DB.commitTransaction(); } @@ -132,39 +131,6 @@ Zotero.Schema = new function(){ throw(e); } - try { - var up3 = _updateSchema('scrapers'); - } - catch (e) { - Zotero.debug(e, 1); - throw(e); - } - - // Workaround for upgrade error in step 35 - if (_fulltextItemWordsCache) { - Zotero.DB.beginTransaction(); - try { - sql = "INSERT INTO fulltextItemWords VALUES (?,?)"; - var insertStatement = Zotero.DB.getStatement(sql); - for (var j=0; j<_fulltextItemWordsCache.length; j++) { - insertStatement.bindInt32Parameter(0, _fulltextItemWordsCache[j]['wordID']); - insertStatement.bindInt32Parameter(1, _fulltextItemWordsCache[j]['itemID']); - insertStatement.execute(); - } - insertStatement.reset(); - Zotero.DB.commitTransaction(); - - Zotero.DB.beginTransaction(); - Zotero.DB.query("INSERT INTO fulltextItems SELECT DISTINCT itemID, 1, NULL, NULL, NULL, NULL FROM fulltextItemWords"); - Zotero.DB.commitTransaction(); - } - catch (e) { - Zotero.debug(e); - Zotero.DB.rollbackTransaction(); - throw(e); - } - } - if (up1) { // Upgrade seems to have been a success -- delete any previous backups var maxPrevious = dbVersion - 1; @@ -1245,14 +1211,7 @@ Zotero.Schema = new function(){ } if (i==35) { - Zotero.DB.query("CREATE TABLE fulltextItemWords (\n wordID INT,\n itemID INT,\n PRIMARY KEY (wordID, itemID),\n FOREIGN KEY (wordID) REFERENCES fulltextWords(wordID),\n FOREIGN KEY (itemID) REFERENCES items(itemID)\n);"); - - // A direct copy to fulltextItemWords seems to expose an SQLite or Firefox bug - // related to the size of the transaction, so we save the rows to a JS array and - // update after the transaction - _fulltextItemWordsCache = Zotero.DB.query("SELECT * FROM fulltextItems"); - - Zotero.DB.query("DROP TABLE fulltextItems"); + Zotero.DB.query("ALTER TABLE fulltextItems RENAME TO fulltextItemWords"); Zotero.DB.query("CREATE TABLE fulltextItems (\n itemID INT,\n version INT,\n PRIMARY KEY (itemID),\n FOREIGN KEY (itemID) REFERENCES items(itemID)\n);"); }