mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
added demo document SQL scripts
This commit is contained in:
@@ -6,6 +6,7 @@ const sql = require('../../services/sql');
|
||||
const utils = require('../../services/utils');
|
||||
const sync_table = require('../../services/sync_table');
|
||||
const auth = require('../../services/auth');
|
||||
const log = require('../../services/log');
|
||||
|
||||
router.post('/cleanup-soft-deleted-items', auth.checkApiAuth, async (req, res, next) => {
|
||||
await sql.doInTransaction(async () => {
|
||||
@@ -14,8 +15,6 @@ router.post('/cleanup-soft-deleted-items', auth.checkApiAuth, async (req, res, n
|
||||
.map(noteId => "'" + utils.sanitizeSql(noteId) + "'")
|
||||
.join(', ');
|
||||
|
||||
console.log("Note IDS for deletion", noteIdsSql);
|
||||
|
||||
await sql.execute(`DELETE FROM event_log WHERE note_id IN (${noteIdsSql})`);
|
||||
|
||||
await sql.execute(`DELETE FROM notes_history WHERE note_id IN (${noteIdsSql})`);
|
||||
@@ -30,6 +29,8 @@ router.post('/cleanup-soft-deleted-items', auth.checkApiAuth, async (req, res, n
|
||||
await sync_table.cleanupSyncRowsForMissingEntities("notes_tree", "note_tree_id");
|
||||
await sync_table.cleanupSyncRowsForMissingEntities("notes_history", "note_history_id");
|
||||
await sync_table.cleanupSyncRowsForMissingEntities("recent_notes", "note_tree_id");
|
||||
|
||||
log.info("Following notes has been completely cleaned from database: " + noteIdsSql);
|
||||
});
|
||||
|
||||
res.send({});
|
||||
@@ -38,6 +39,8 @@ router.post('/cleanup-soft-deleted-items', auth.checkApiAuth, async (req, res, n
|
||||
router.post('/vacuum-database', auth.checkApiAuth, async (req, res, next) => {
|
||||
await sql.execute("VACUUM");
|
||||
|
||||
log.info("Database has been vacuumed.");
|
||||
|
||||
res.send({});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user