1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Merge branch 'master' into encryption

This commit is contained in:
Laurent Cozic
2017-12-31 15:26:16 +01:00
43 changed files with 5619 additions and 506 deletions

View File

@@ -205,10 +205,13 @@ class JoplinDatabase extends Database {
const existingDatabaseVersions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let currentVersionIndex = existingDatabaseVersions.indexOf(fromVersion);
if (currentVersionIndex < 0) throw new Error('Unknown profile version. Most likely this is an old version of Joplin, while the profile was created by a newer version. Please upgrade Joplin at http://joplin.cozic.net and try again.');
// currentVersionIndex < 0 if for the case where an old version of Joplin used with a newer
// version of the database, so that migration is not run in this case.
if (currentVersionIndex == existingDatabaseVersions.length - 1 || currentVersionIndex < 0) return false;
if (currentVersionIndex == existingDatabaseVersions.length - 1) return false;
while (currentVersionIndex < existingDatabaseVersions.length - 1) {
const targetVersion = existingDatabaseVersions[currentVersionIndex + 1];
this.logger().info("Converting database to version " + targetVersion);