Fix invalid relations from copying invalid feed item to collection

Prior to fdfa8052d1, it was possible to create an item in a feed
library using Add Item by Identifier. If you did that, and then copied
it to a collection in your personal library, it would somehow end up
with an owl:sameAs relation to a `/users/local` URI (probably because
the URI functions don't work properly on a feed library).

This will clean up such relations in a schema update.
This commit is contained in:
Dan Stillman 2020-04-17 05:35:43 -04:00
parent fdfa8052d1
commit 595ba396ef
2 changed files with 6 additions and 2 deletions

View file

@ -41,7 +41,7 @@ Zotero.Schema = new function(){
// If updating from this userdata version or later, don't show "Upgrading database…" and don't make
// DB backup first. This should be set to false when breaking compatibility or making major changes.
const minorUpdateFrom = false;
const minorUpdateFrom = 107;
var _dbVersions = [];
var _schemaVersions = [];
@ -3015,6 +3015,10 @@ Zotero.Schema = new function(){
}
}
else if (i == 108) {
yield Zotero.DB.queryAsync(`DELETE FROM itemRelations WHERE predicateID=(SELECT predicateID FROM relationPredicates WHERE predicate='owl:sameAs') AND object LIKE ?`, 'http://zotero.org/users/local/%');
}
// If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
}

View file

@ -1,4 +1,4 @@
-- 107
-- 108
-- Copyright (c) 2009 Center for History and New Media
-- George Mason University, Fairfax, Virginia, USA