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

This commit is contained in:
azivner 2017-10-28 10:21:55 -04:00
parent a2f0a372a5
commit a76e82e9a2
3 changed files with 7 additions and 4 deletions

View file

@ -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);

View file

@ -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 != ?) " + 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]); "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({ res.send({
'changed': row.count > 0 'changed': row.count > 0
}); });

View file

@ -3,7 +3,7 @@ const sql = require('./sql');
const fs = require('fs-extra'); const fs = require('fs-extra');
const log = require('./log'); const log = require('./log');
const APP_DB_VERSION = 14; const APP_DB_VERSION = 15;
const MIGRATIONS_DIR = "./migrations"; const MIGRATIONS_DIR = "./migrations";
async function migrate() { async function migrate() {