feat: implémenter réellement la sauvegarde hebdomadaire de la base
This commit is contained in:
+14
-1
@@ -1,6 +1,19 @@
|
||||
const path = require('path');
|
||||
const {backupDatabase} = require('../src/utils/backup-database');
|
||||
|
||||
module.exports = {
|
||||
myJob: {
|
||||
task: ({ strapi }) => {console.log('TODO > save db')},
|
||||
task: ({ strapi }) => {
|
||||
const dbPath = path.join(__dirname, '..', process.env.DATABASE_FILENAME || '.tmp/data.db');
|
||||
const backupsDir = path.join(__dirname, '..', 'backups');
|
||||
const backupPath = backupDatabase({dbPath, backupsDir});
|
||||
|
||||
if (backupPath) {
|
||||
strapi.log.info(`Sauvegarde de la base effectuée : ${backupPath}`);
|
||||
} else {
|
||||
strapi.log.warn(`Sauvegarde de la base ignorée : fichier introuvable (${dbPath})`);
|
||||
}
|
||||
},
|
||||
options: {
|
||||
rule: '0 0 * * SUN',
|
||||
tz: 'Indian/Reunion',
|
||||
|
||||
Reference in New Issue
Block a user