www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 30e4ae859da12904167803ecff4dfcfc9198014f
parent d875079377abaaa12a8f0d98a4e471f049275ab6
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 25 Jul 2008 19:00:44 +0000

Fix "data mismatch" error, for real


Diffstat:
Mchrome/content/zotero/xpcom/schema.js | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js @@ -1632,8 +1632,14 @@ Zotero.Schema = new function(){ // Migrate big integers var itemIDs = Zotero.DB.columnQuery("SELECT itemID FROM items WHERE itemID>16777215"); + var smalls = Zotero.DB.columnQuery("SELECT itemID FROM items WHERE itemID<300000"); + var newID = Math.max.apply(this, smalls); for each(var oldID in itemIDs) { - var newID = Zotero.ID.get('items'); + do { + newID = newID + 1; + var exists = Zotero.DB.valueQuery("SELECT COUNT(*) FROM items WHERE itemID=?", newID); + } + while (exists); var params = [newID, oldID]; Zotero.DB.query("UPDATE items SET itemID=? WHERE itemID=?", params); Zotero.DB.query("UPDATE annotations SET itemID=? WHERE itemID=?", params);