From 5c9f0a389d974c74e9d04e994781d448d08b00d2 Mon Sep 17 00:00:00 2001 From: Jack Liao Date: Tue, 7 Jul 2020 19:11:24 +0800 Subject: [PATCH] add back-db.js --- backup-db.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backup-db.js diff --git a/backup-db.js b/backup-db.js new file mode 100644 index 0000000..1360c48 --- /dev/null +++ b/backup-db.js @@ -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) + }) \ No newline at end of file