From a76e82e9a29927086f4b3ee396dbc24647ca9c88 Mon Sep 17 00:00:00 2001 From: azivner Date: Sat, 28 Oct 2017 10:21:55 -0400 Subject: [PATCH] trim note_ids to 22 characters (there was a bug in nodejs backend which generated 32 character noteids) --- migrations/0015__trim_note_ids.sql | 6 ++++++ routes/api/audit.js | 3 --- services/migration.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 migrations/0015__trim_note_ids.sql diff --git a/migrations/0015__trim_note_ids.sql b/migrations/0015__trim_note_ids.sql new file mode 100644 index 000000000..3b981d172 --- /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 4311d0d9e..4e376d680 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 01126d09e..db215ba95 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() {