Closes #1112, Show "Upgrading database…" message
This commit is contained in:
parent
a1710c3307
commit
65a39417bf
3 changed files with 16 additions and 4 deletions
|
@ -72,7 +72,7 @@ Zotero.Schema = new function(){
|
|||
/*
|
||||
* Checks if the DB schema exists and is up-to-date, updating if necessary
|
||||
*/
|
||||
this.updateSchema = Zotero.Promise.coroutine(function* () {
|
||||
this.updateSchema = Zotero.Promise.coroutine(function* (options = {}) {
|
||||
// TODO: Check database integrity first with Zotero.DB.integrityCheck()
|
||||
|
||||
// 'userdata' is the last upgrade step run in _migrateUserDataSchema() based on the
|
||||
|
@ -133,7 +133,7 @@ Zotero.Schema = new function(){
|
|||
if (Zotero.DB.tableExists('customItemTypes')) {
|
||||
yield _updateCustomTables(updated);
|
||||
}
|
||||
updated = yield _migrateUserDataSchema(userdata);
|
||||
updated = yield _migrateUserDataSchema(userdata, options);
|
||||
yield _updateSchema('triggers');
|
||||
|
||||
// Populate combined tables for custom types and fields -- this is likely temporary
|
||||
|
@ -1859,7 +1859,7 @@ Zotero.Schema = new function(){
|
|||
//
|
||||
// If libraryID set, make sure no relations still use a local user key, and then remove on-error code in sync.js
|
||||
|
||||
var _migrateUserDataSchema = Zotero.Promise.coroutine(function* (fromVersion) {
|
||||
var _migrateUserDataSchema = Zotero.Promise.coroutine(function* (fromVersion, options = {}) {
|
||||
var toVersion = yield _getSchemaSQLVersion('userdata');
|
||||
|
||||
if (fromVersion >= toVersion) {
|
||||
|
@ -1868,6 +1868,13 @@ Zotero.Schema = new function(){
|
|||
|
||||
Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion);
|
||||
|
||||
if (options.onBeforeUpdate) {
|
||||
let maybePromise = options.onBeforeUpdate()
|
||||
if (maybePromise && maybePromise.then) {
|
||||
yield maybePromise;
|
||||
}
|
||||
}
|
||||
|
||||
Zotero.DB.requireTransaction();
|
||||
|
||||
// Step through version changes until we reach the current version
|
||||
|
|
|
@ -561,7 +561,11 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
|
|||
}
|
||||
|
||||
try {
|
||||
var updated = yield Zotero.Schema.updateSchema();
|
||||
var updated = yield Zotero.Schema.updateSchema({
|
||||
onBeforeUpdate: () => Zotero.showZoteroPaneProgressMeter(
|
||||
Zotero.getString('upgrade.status')
|
||||
)
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
|
|
|
@ -72,6 +72,7 @@ install.quickStartGuide.message.welcome = Welcome to Zotero!
|
|||
install.quickStartGuide.message.view = View the Quick Start Guide to learn how to begin collecting, managing, citing, and sharing your research sources.
|
||||
install.quickStartGuide.message.thanks = Thanks for installing Zotero.
|
||||
|
||||
upgrade.status = Upgrading database…
|
||||
upgrade.failed.title = Upgrade Failed
|
||||
upgrade.failed = Upgrading of the Zotero database failed:
|
||||
upgrade.advanceMessage = Press %S to upgrade now.
|
||||
|
|
Loading…
Reference in a new issue