commit a455a7253491af9d61502a3b6c36f4e76c0f00e0
parent 0d3d4323b5b457d119228df66707257b985a02d8
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 22 Sep 2017 01:22:33 -0400
Remove invalid relations mangled during import
Not sure if this occurred for our own translators, but it addresses
items created from #1282.
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -2469,6 +2469,16 @@ Zotero.Schema = new function(){
yield Zotero.DB.queryAsync("REPLACE INTO fileTypeMIMETypes VALUES(7, 'application/vnd.ms-powerpoint')");
}
+ else if (i == 97) {
+ let where = "WHERE predicate IN (" + Array.from(Array(20).keys()).map(i => `'${i}'`).join(', ') + ")";
+ let rows = yield Zotero.DB.queryAsync("SELECT * FROM relationPredicates " + where);
+ for (let row of rows) {
+ yield Zotero.DB.columnQueryAsync("UPDATE items SET synced=0 WHERE itemID IN (SELECT itemID FROM itemRelations WHERE predicateID=?)", row.predicateID);
+ yield Zotero.DB.queryAsync("DELETE FROM itemRelations WHERE predicateID=?", row.predicateID);
+ }
+ yield Zotero.DB.queryAsync("DELETE FROM relationPredicates " + where);
+ }
+
// If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
}
diff --git a/resource/schema/userdata.sql b/resource/schema/userdata.sql
@@ -1,4 +1,4 @@
--- 96
+-- 97
-- Copyright (c) 2009 Center for History and New Media
-- George Mason University, Fairfax, Virginia, USA