-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset.js
executable file
·29 lines (24 loc) · 893 Bytes
/
reset.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env node
var sqlite3 = require('sqlite3');
var db = new sqlite3.Database('./db.sqlite3');
db.run('DELETE FROM user', function(err) {
if (err) console.log("Error truncating user table: " + err);
});
db.run('DELETE FROM question', function(err) {
if (err) console.log("Error truncating question table: " + err);
});
db.run('DELETE FROM response', function(err) {
if (err) console.log("Error truncating response table: " + err);
});
db.run('DELETE FROM sessions', function(err) {
if (err) console.log("Error truncating sessions table: " + err);
});
var webhook = require('./app/helpers/webhook');
webhook.getHooks(function(err, hooks) {
if (err) console.log("Error deleting web hooks: " + err);
for (var i=0; i<hooks.length; i++) {
webhook.deleteHook(hooks[i].webhook_id, function(err) {
if (err)console.log("Error deleting webhook: " + err);
});
}
});