Skip to content

Commit

Permalink
feat: add database backup
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev committed Oct 9, 2021
1 parent 6667d3c commit 6e412b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/node_modules
/commands/dev/eval.js
database.sqlite3
/backup
.env

# General
Expand Down
12 changes: 12 additions & 0 deletions commands/dev/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ module.exports = {
}

const [ action, ...statement ] = args;

if (action === 'backup') {
await client.db.backup(`./backup/backup-${Date.now()}.sqlite3`);
return message.channel.send({
embeds: [{
title: 'SQL',
description: 'Backup complete',
color: client.config.color
}]
});
}

let db;
let error;
try {
Expand Down

0 comments on commit 6e412b5

Please sign in to comment.