gd-utils/backup-db.js

14 lines
283 B
JavaScript
Raw Normal View History

2020-07-07 19:11:24 +08:00
#!/usr/bin/env node
const path = require('path')
const {db} = require('./db')
const filepath = path.join(__dirname, 'backup', `${Date.now()}.sqlite`)
db.backup(filepath)
.then(() => {
console.log(filepath)
})
.catch((err) => {
console.log('backup failed:', err)
})