Fix redundant Number on Dataset item type

This commit is contained in:
Dan Stillman 2023-04-20 03:21:33 -04:00
parent f57c462b85
commit 1ec37ebcbf
4 changed files with 14 additions and 5 deletions

View file

@ -556,7 +556,7 @@ Zotero.Items = function() {
}
catch (e) {
if (e.message.includes('no such column: IA.authorName')
&& await Zotero.DB.valueQueryAsync("SELECT COUNT(*) FROM version WHERE schema='userdata' AND version=120")) {
&& await Zotero.DB.valueQueryAsync("SELECT COUNT(*) FROM version WHERE schema='userdata' AND version IN (120, 121)")) {
await Zotero.DB.queryAsync("UPDATE version SET version=119 WHERE schema='userdata'");
Zotero.crash();
}

View file

@ -3468,8 +3468,17 @@ Zotero.Schema = new function(){
}
}
// TEMP: When adding 121, check whether IA.authorName fix in items.js::_loadAnnotations()
// should be updated
else if (i == 121) {
let datasetItemTypeID = await Zotero.DB.valueQueryAsync("SELECT itemTypeID FROM itemTypes WHERE typeName='dataset'");
let numberFieldID = await Zotero.DB.valueQueryAsync("SELECT fieldID FROM fields WHERE fieldName='number'");
if (datasetItemTypeID && numberFieldID) {
await Zotero.DB.queryAsync("DELETE FROM itemData WHERE fieldID=? AND itemID IN (SELECT itemID FROM items WHERE itemTypeID=?)", [numberFieldID, datasetItemTypeID]);
await Zotero.DB.queryAsync("DELETE FROM itemTypeFields WHERE itemTypeID=? AND fieldID=?", [datasetItemTypeID, numberFieldID]);
}
}
// TEMP: When adding 122, check whether IA.authorName fix in items.js::_loadAnnotations()
// can be updated due to update steps being indempodent
// If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
}

@ -1 +1 @@
Subproject commit 46feab5ce7eed164fe56127428f5ffb25a02cf0f
Subproject commit 1b12272d44134a652519e9192e5a936ac9fcd707

View file

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