mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix sync of audit log
This commit is contained in:
parent
791314ba1a
commit
297da47b34
16
migrations/0014__change_audit_log_id.sql
Normal file
16
migrations/0014__change_audit_log_id.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
CREATE TABLE `audit_log_mig` (
|
||||||
|
`id` TEXT NOT NULL PRIMARY KEY,
|
||||||
|
`date_modified` INTEGER NOT NULL,
|
||||||
|
`category` TEXT NOT NULL,
|
||||||
|
`browser_id` TEXT,
|
||||||
|
`note_id` TEXT,
|
||||||
|
`change_from` TEXT,
|
||||||
|
`change_to` TEXT,
|
||||||
|
`comment` TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO audit_log_mig (id, date_modified, category, browser_id, note_id, change_from, change_to)
|
||||||
|
SELECT id, date_modified, category, browser_id, note_id, change_from, change_to FROM audit_log;
|
||||||
|
|
||||||
|
DROP TABLE audit_log;
|
||||||
|
ALTER TABLE audit_log_mig RENAME TO audit_log;
|
@ -102,6 +102,10 @@ setInterval(() => {
|
|||||||
// if the user got logged out then we should display the page
|
// if the user got logged out then we should display the page
|
||||||
// here we do that by reloading which will force the redirect if the user is really logged out
|
// here we do that by reloading which will force the redirect if the user is really logged out
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
|
},
|
||||||
|
409: () => {
|
||||||
|
// 409 means we need to migrate database, reload will take care of it
|
||||||
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -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 = 13;
|
const APP_DB_VERSION = 14;
|
||||||
const MIGRATIONS_DIR = "./migrations";
|
const MIGRATIONS_DIR = "./migrations";
|
||||||
|
|
||||||
async function migrate() {
|
async function migrate() {
|
||||||
|
@ -135,8 +135,6 @@ async function putChanged(changed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const audit of changed.audit_log) {
|
for (const audit of changed.audit_log) {
|
||||||
delete audit['id'];
|
|
||||||
|
|
||||||
await sql.insert("audit_log", audit, true);
|
await sql.insert("audit_log", audit, true);
|
||||||
|
|
||||||
log.info("Update/sync audit_log for noteId=" + audit.note_id);
|
log.info("Update/sync audit_log for noteId=" + audit.note_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user