mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 02:30:42 +01:00
unifying surrogate keys for event log and options, fixes #103
This commit is contained in:
@@ -3,19 +3,9 @@
|
||||
const sql = require('../../services/sql');
|
||||
|
||||
async function getEventLog() {
|
||||
await deleteOld();
|
||||
|
||||
return await sql.getRows("SELECT * FROM event_log ORDER BY dateCreated DESC");
|
||||
}
|
||||
|
||||
async function deleteOld() {
|
||||
const cutoffId = await sql.getValue("SELECT id FROM event_log ORDER BY id DESC LIMIT 1000, 1");
|
||||
|
||||
if (cutoffId) {
|
||||
await sql.execute("DELETE FROM event_log WHERE id < ?", [cutoffId]);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getEventLog
|
||||
};
|
||||
Reference in New Issue
Block a user