Skip to content

Build your personal knowledge base with Trilium Notes

trim note_ids to 22 characters (there was a bug in nodejs backend which generated 32 character noteids)

azivnera76e82e9a299
diff --git a/migrations/0015__trim_note_ids.sql b/migrations/0015__trim_note_ids.sql
new file mode 100644
index 0000000000..3b981d1729
--- /dev/null
+++ b/migrations/0015__trim_note_ids.sql
@@ -0,0 +1,6 @@
+UPDATE notes SET note_id = substr(note_id, 0, 22);
+UPDATE notes_tree SET note_id = substr(note_id, 0, 22), note_pid = substr(note_pid, 0, 22);
+UPDATE notes_history SET note_id = substr(note_id, 0, 22);
+UPDATE audit_log SET note_id = substr(note_id, 0, 22);
+UPDATE links SET note_id = substr(note_id, 0, 22);
+UPDATE images SET note_id = substr(note_id, 0, 22);
\ No newline at end of file
diff --git a/routes/api/audit.js b/routes/api/audit.js
index 4311d0d9eb..4e376d680f 100644
--- a/routes/api/audit.js
+++ b/routes/api/audit.js
@@ -13,9 +13,6 @@ router.get('/:full_load_time', auth.checkApiAuth, async (req, res, next) => {
const row = await sql.getSingleResult("SELECT COUNT(*) AS 'count' FROM audit_log WHERE (browser_id IS NULL OR browser_id != ?) " +
"AND date_modified >= ?", [browserId, fullLoadTime]);
- console.log("SELECT COUNT(*) AS 'count' FROM audit_log WHERE (browser_id IS NULL OR browser_id != ?) " +
- "AND date_modified >= ?");
-
res.send({
'changed': row.count > 0
});
diff --git a/services/migration.js b/services/migration.js
index 01126d09ed..db215ba95d 100644
--- a/services/migration.js
+++ b/services/migration.js
@@ -3,7 +3,7 @@ const sql = require('./sql');
const fs = require('fs-extra');
const log = require('./log');
-const APP_DB_VERSION = 14;
+const APP_DB_VERSION = 15;
const MIGRATIONS_DIR = "./migrations";
async function migrate() {