Skip to content

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

fix: add attachments support to migrator & backup

thecodrr23e584f272d2
diff --git a/packages/core/api/migrations.js b/packages/core/api/migrations.js
index 5a5259f03..a1a9d30d1 100644
--- a/packages/core/api/migrations.js
+++ b/packages/core/api/migrations.js
@@ -24,6 +24,7 @@ class Migrations {
const content = await this._db.content.all();
const collections = [
+ { index: this._db.attachments.all, dbCollection: this._db.attachments },
{
index: this._db.notebooks.raw,
dbCollection: this._db.notebooks,
diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.js
index 6a4f5e011..b05cbd665 100644
--- a/packages/core/collections/attachments.js
+++ b/packages/core/collections/attachments.js
@@ -62,6 +62,7 @@ export default class Attachments extends Collection {
const encryptedKey = await this._encryptKey(key);
const attachmentItem = {
+ type: "attachment",
id: id(),
noteIds: noteId ? [noteId] : [],
iv,
diff --git a/packages/core/database/backup.js b/packages/core/database/backup.js
index 27ad1abfe..7c0d4a3e1 100644
--- a/packages/core/database/backup.js
+++ b/packages/core/database/backup.js
@@ -117,6 +117,10 @@ export default class Backup {
// properly.
reindex(data);
const collections = [
+ {
+ index: data["attachments"],
+ dbCollection: this._db.attachments,
+ },
{
index: data["notebooks"],
dbCollection: this._db.notebooks,
diff --git a/packages/core/migrations.js b/packages/core/migrations.js
index 267873f7f..3295e09a7 100644
--- a/packages/core/migrations.js
+++ b/packages/core/migrations.js
@@ -30,6 +30,7 @@ export const migrations = {
note: false,
notebook: false,
tag: false,
+ attachment: false,
trash: false,
tiny: false,
settings: false,