create and integrate dbtools.js

master
lub 7 years ago
parent 7309245a53
commit 5340410ff2

@ -0,0 +1,13 @@
const dbtools = module.exports = {};
dbtools.createSchema = (db) => {
db.run('CREATE TABLE IF NOT EXISTS permissions ( \
id INTEGER PRIMARY KEY NOT NULL, \
mxid TEXT, \
omni INTEGER, \
project TEXT, \
service TEXT, \
subcommand TEXT, \
args TEXT \
)'); // the inner bracket for sql, the outer for closing the function*/
};

@ -1,4 +1,5 @@
const commands = require('./commands.js');
const dbtools = require('./dbtools.js');
const fs = require('fs');
const sdk = require('matrix-js-sdk');
const sqlite3 = require('sqlite3').verbose(); // .verbose until basics work
@ -12,6 +13,7 @@ global.matrixClient = sdk.createClient({
});
const db = new sqlite3.Database(config.database);
dbtools.createSchema(db);
//captures unhandled rejections for easier debugging
process.on('unhandledRejection', (reason) => {