Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: add migration to remove item.remote

Abdullah Atta030aba2ac33e
diff --git a/packages/core/src/common.js b/packages/core/src/common.js
index ec4bd8556..8bf6016f5 100644
--- a/packages/core/src/common.js
+++ b/packages/core/src/common.js
@@ -125,4 +125,4 @@ export const DATE_FORMATS = [
export const TIME_FORMATS = ["12-hour", "24-hour"];
-export const CURRENT_DATABASE_VERSION = 5.8;
+export const CURRENT_DATABASE_VERSION = 5.9;
diff --git a/packages/core/src/database/backup.js b/packages/core/src/database/backup.js
index a17ce3454..32e902fdb 100644
--- a/packages/core/src/database/backup.js
+++ b/packages/core/src/database/backup.js
@@ -127,6 +127,7 @@ export default class Backup {
switch (version) {
case CURRENT_DATABASE_VERSION:
+ case 5.8:
case 5.7:
case 5.6:
case 5.5:
diff --git a/packages/core/src/migrations.js b/packages/core/src/migrations.js
index d2adbffd9..499eb94c9 100644
--- a/packages/core/src/migrations.js
+++ b/packages/core/src/migrations.js
@@ -133,7 +133,15 @@ const migrations = [
}
}
},
- { version: 5.8, items: {} }
+ {
+ version: 5.8,
+ items: {
+ all: (item) => {
+ delete item.remote;
+ }
+ }
+ },
+ { version: 5.9, items: {} }
];
export async function migrateItem(item, version, type, database) {
@@ -151,7 +159,9 @@ export async function migrateItem(item, version, type, database) {
const migration = migrations[migrationStartIndex];
if (migration.version === CURRENT_DATABASE_VERSION) break;
- const itemMigrator = migration.items && migration.items[type];
+ const itemMigrator = migration.items
+ ? migration.items[type] || migration.items.all
+ : null;
if (!itemMigrator) continue;
if (await itemMigrator(item, database)) count++;
}