A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
core: fix migration bugs
Ammar Ahmedd0f0c32ffa7f
diff --git a/packages/core/src/api/lookup.ts b/packages/core/src/api/lookup.tsindex 49f519827..cc2ee075f 100644--- a/packages/core/src/api/lookup.ts+++ b/packages/core/src/api/lookup.ts@@ -43,7 +43,7 @@ export default class Lookup {return this.toSearchResults(async (limit) => {if (query.length <= 3) return [];- const db = this.db.sql() as Kysely<RawDatabaseSchema>;+ const db = this.db.sql() as unknown as Kysely<RawDatabaseSchema>;query = query.replace(/"/, '""');const result = await db.with("matching", (eb) =>diff --git a/packages/core/src/database/backup.ts b/packages/core/src/database/backup.tsindex 0de75a9de..5c7582d4b 100644--- a/packages/core/src/database/backup.ts+++ b/packages/core/src/database/backup.ts@@ -436,6 +436,9 @@ export default class Backup {}const collectionKey = itemTypeToCollectionKey[itemType];++ if (!collectionKey) continue;+const collection =collectionKey === "sessioncontent"? this.db.noteHistory.sessionContent.collectiondiff --git a/packages/core/src/migrations.ts b/packages/core/src/migrations.tsindex 53a5b65be..53dd30e5d 100644--- a/packages/core/src/migrations.ts+++ b/packages/core/src/migrations.ts@@ -181,6 +181,13 @@ const migrations: Migration[] = [if (!item.deletedBy) item.deletedBy = "user";return true;},+ color: async (item, db, migrationType) => {+ return (+ (await migrations+ .find((migration) => migration.version === 5.9)+ ?.items.tag?.(item as any, db, migrationType)) || false+ );+ },tag: async (item, db) => {const oldTagId = makeId(item.title);const alias = db.legacySettings.getAlias(item.id);@@ -325,6 +332,7 @@ const migrations: Migration[] = [}delete item.topics;delete item.totalNotes;+ delete item.topic;return true;},shortcut: (item) => {@@ -386,8 +394,10 @@ const migrations: Migration[] = [},tiptap: (item) => {item.locked = isCipher(item.data);+ delete item.resolved;return true;},+all: () => true},async vaultKey(db, key) {@@ -444,7 +454,8 @@ export async function migrateItem<TItemType extends MigrationItemType>(const result = await itemMigrator(item, database, migrationType);if (result === "skip") return "skip";if (result) {- if (item.type && item.type !== type) type = item.type as TItemType;+ if (item.type && item.type !== "trash" && item.type !== type)+ type = item.type as TItemType;count++;}}