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

Per-target sync context

This commit is contained in:
Laurent Cozic
2017-08-19 22:56:28 +02:00
parent 0cf8d3fd74
commit a5daccce09
10 changed files with 39 additions and 27 deletions

View File

@ -193,7 +193,7 @@ class JoplinDatabase extends Database {
// 1. Add the new version number to the existingDatabaseVersions array
// 2. Add the upgrade logic to the "switch (targetVersion)" statement below
const existingDatabaseVersions = [0, 1, 2, 3];
const existingDatabaseVersions = [0, 1, 2, 3, 4];
let currentVersionIndex = existingDatabaseVersions.indexOf(fromVersion);
if (currentVersionIndex == existingDatabaseVersions.length - 1) return false;
@ -228,6 +228,11 @@ class JoplinDatabase extends Database {
queries = this.alterColumnQueries('settings', { key: 'TEXT PRIMARY KEY', value: 'TEXT' });
}
if (targetVersion == 4) {
queries.push("INSERT INTO settings (`key`, `value`) VALUES ('sync.3.context', (SELECT `value` FROM settings WHERE `key` = 'sync.context'))");
queries.push('DELETE FROM settings WHERE `key` = "sync.context"');
}
queries.push({ sql: 'UPDATE version SET version = ?', params: [targetVersion] });
await this.transactionExecBatch(queries);