From c240fb98967d11ea3925c2c39b44138bb8e46f58 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 30 Mar 2019 20:09:38 +0100 Subject: [PATCH] migration for inconsistent isProtected status across notes and note_contents --- db/migrations/0127__fix_inconsistent_isProtected.sql | 6 ++++++ src/services/app_info.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrations/0127__fix_inconsistent_isProtected.sql diff --git a/db/migrations/0127__fix_inconsistent_isProtected.sql b/db/migrations/0127__fix_inconsistent_isProtected.sql new file mode 100644 index 000000000..6b4467e44 --- /dev/null +++ b/db/migrations/0127__fix_inconsistent_isProtected.sql @@ -0,0 +1,6 @@ +UPDATE notes SET title = 'Recovered protected note', isProtected = 0 WHERE noteId IN ( + SELECT noteId FROM notes JOIN note_contents USING(noteId) + WHERE notes.isProtected = 1 + AND note_contents.isProtected = 0 + AND notes.isDeleted = 0 +) \ No newline at end of file diff --git a/src/services/app_info.js b/src/services/app_info.js index 7396fceb4..3cc45504e 100644 --- a/src/services/app_info.js +++ b/src/services/app_info.js @@ -4,7 +4,7 @@ const build = require('./build'); const packageJson = require('../../package'); const {TRILIUM_DATA_DIR} = require('./data_dir'); -const APP_DB_VERSION = 126; +const APP_DB_VERSION = 127; const SYNC_VERSION = 6; module.exports = {