diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 11cf5f28e..4783758e4 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -35,6 +35,10 @@ Zotero.Schema = new function(){ var _schemaUpdateDeferred = Zotero.Promise.defer(); this.schemaUpdatePromise = _schemaUpdateDeferred.promise; + // 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 = 95; + var _dbVersions = []; var _schemaVersions = []; // Update when adding _updateCompatibility() line to schema update step @@ -131,9 +135,10 @@ Zotero.Schema = new function(){ ); var schemaVersion = yield _getSchemaSQLVersion('userdata'); + options.minor = minorUpdateFrom && userdata >= minorUpdateFrom; - // If upgrading userdata, make backup of database first - if (userdata < schemaVersion) { + // If non-minor userdata upgrade, make backup of database first + if (userdata < schemaVersion && !options.minor) { yield Zotero.DB.backupDatabase(userdata, true); } else if (integrityCheck) { @@ -1909,7 +1914,7 @@ Zotero.Schema = new function(){ Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion); if (options.onBeforeUpdate) { - let maybePromise = options.onBeforeUpdate() + let maybePromise = options.onBeforeUpdate({ minor: options.minor }); if (maybePromise && maybePromise.then) { yield maybePromise; } @@ -2449,6 +2454,12 @@ Zotero.Schema = new function(){ else if (i == 95) { yield Zotero.DB.queryAsync("DELETE FROM publicationsItems WHERE itemID NOT IN (SELECT itemID FROM items WHERE libraryID=1)"); } + + else if (i == 96) { + yield Zotero.DB.queryAsync("REPLACE INTO fileTypeMIMETypes VALUES(7, 'application/vnd.ms-powerpoint')"); + } + + // If breaking compatibility or doing anything dangerous, clear minorUpdateFrom } yield _updateDBVersion('userdata', toVersion); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 3da407126..5a7e3a760 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -618,7 +618,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); try { var updated = yield Zotero.Schema.updateSchema({ - onBeforeUpdate: () => { + onBeforeUpdate: (options = {}) => { + if (options.minor) return; try { Zotero.showZoteroPaneProgressMeter( Zotero.getString('upgrade.status') diff --git a/resource/schema/system.sql b/resource/schema/system.sql index d589d087f..eaad2b52f 100644 --- a/resource/schema/system.sql +++ b/resource/schema/system.sql @@ -1223,6 +1223,7 @@ INSERT INTO "fileTypeMIMETypes" VALUES(6, 'application/vnd.oasis.opendocument.te INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/powerpoint'); INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.oasis.opendocument.presentation'); INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/x-kpresenter'); +INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.ms-powerpoint'); INSERT INTO "syncObjectTypes" VALUES(1, 'collection'); INSERT INTO "syncObjectTypes" VALUES(2, 'creator'); diff --git a/resource/schema/userdata.sql b/resource/schema/userdata.sql index 74c01eb65..034fd9bd0 100644 --- a/resource/schema/userdata.sql +++ b/resource/schema/userdata.sql @@ -1,4 +1,4 @@ --- 95 +-- 96 -- Copyright (c) 2009 Center for History and New Media -- George Mason University, Fairfax, Virginia, USA