From 9720868f5a2322815a929cbe8be3a356ec32d020 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 8 Apr 2018 11:57:14 -0400 Subject: [PATCH] added type and mime to note revisions --- db/migrations/0087__add_type_mime_to_note_revision.sql | 5 +++++ src/services/app_info.js | 2 +- src/services/notes.js | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrations/0087__add_type_mime_to_note_revision.sql diff --git a/db/migrations/0087__add_type_mime_to_note_revision.sql b/db/migrations/0087__add_type_mime_to_note_revision.sql new file mode 100644 index 000000000..f4b6629e3 --- /dev/null +++ b/db/migrations/0087__add_type_mime_to_note_revision.sql @@ -0,0 +1,5 @@ +ALTER TABLE note_revisions ADD type TEXT DEFAULT '' NOT NULL; +ALTER TABLE note_revisions ADD mime TEXT DEFAULT '' NOT NULL; + +UPDATE note_revisions SET type = (SELECT type FROM notes WHERE notes.noteId = note_revisions.noteId); +UPDATE note_revisions SET mime = (SELECT mime FROM notes WHERE notes.noteId = note_revisions.noteId); \ No newline at end of file diff --git a/src/services/app_info.js b/src/services/app_info.js index 6e8298922..0afd74203 100644 --- a/src/services/app_info.js +++ b/src/services/app_info.js @@ -3,7 +3,7 @@ const build = require('./build'); const packageJson = require('../../package'); -const APP_DB_VERSION = 86; +const APP_DB_VERSION = 87; module.exports = { appVersion: packageJson.version, diff --git a/src/services/notes.js b/src/services/notes.js index 440a05bb0..29a011e82 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -180,6 +180,8 @@ async function saveNoteRevision(note) { // title and text should be decrypted now title: note.title, content: note.content, + type: note.type, + mime: note.mime, isProtected: 0, // will be fixed in the protectNoteRevisions() call dateModifiedFrom: note.dateModified, dateModifiedTo: dateUtils.nowDate()