Revert [1615-1616] on the trunk, where they're no longer necessary

This commit is contained in:
Dan Stillman 2008-02-05 11:15:53 +00:00
parent 5c02608d51
commit a8d8909e2e

View File

@ -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);");
}