Skip to content

Build your personal knowledge base with Trilium Notes

migration script to fix contentLength = -1 in new notes

zadam1690248e240a
diff --git a/db/migrations/0157__fix_contentLength.sql b/db/migrations/0157__fix_contentLength.sql
new file mode 100644
index 0000000000..63bb6ad352
--- /dev/null
+++ b/db/migrations/0157__fix_contentLength.sql
@@ -0,0 +1 @@
+UPDATE notes SET contentLength = COALESCE((SELECT COALESCE(LENGTH(content), 0) FROM note_contents WHERE note_contents.noteId = notes.noteId), -1);
\ No newline at end of file
diff --git a/src/services/app_info.js b/src/services/app_info.js
index 587d11e62a..0c30da6766 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 = 156;
+const APP_DB_VERSION = 157;
const SYNC_VERSION = 14;
const CLIPPER_PROTOCOL_VERSION = "1.0";