2017-12-23 22:35:00 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const sql = require('../../services/sql');
|
2017-12-24 02:16:18 +08:00
|
|
|
const log = require('../../services/log');
|
2019-12-11 05:03:00 +08:00
|
|
|
const consistencyChecksService = require('../../services/consistency_checks');
|
2018-01-08 03:07:59 +08:00
|
|
|
|
2018-03-31 05:07:41 +08:00
|
|
|
async function vacuumDatabase() {
|
2017-12-23 22:35:00 +08:00
|
|
|
await sql.execute("VACUUM");
|
|
|
|
|
2017-12-24 02:16:18 +08:00
|
|
|
log.info("Database has been vacuumed.");
|
2018-03-31 05:07:41 +08:00
|
|
|
}
|
2017-12-24 02:16:18 +08:00
|
|
|
|
2019-12-11 05:03:00 +08:00
|
|
|
async function findAndFixConsistencyIssues() {
|
|
|
|
await consistencyChecksService.runOnDemandChecks(true);
|
|
|
|
}
|
|
|
|
|
2018-03-31 05:07:41 +08:00
|
|
|
module.exports = {
|
2019-12-11 05:03:00 +08:00
|
|
|
vacuumDatabase,
|
|
|
|
findAndFixConsistencyIssues
|
2018-03-31 05:07:41 +08:00
|
|
|
};
|