add back-db.js

This commit is contained in:
Jack Liao 2020-07-07 19:11:24 +08:00
parent cb101b6573
commit 5c9f0a389d
1 changed files with 14 additions and 0 deletions

14
backup-db.js Normal file
View File

@ -0,0 +1,14 @@
#!/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)
})