Commit bf287869 authored by Big Bad Waffle's avatar Big Bad Waffle

added methods to the rethink and sqlite connectors to create new tables (for use by mods)

parent 61cc9324
......@@ -33,6 +33,15 @@ module.exports = {
}
},
createTable: async function (tableName) {
try {
await r.tableCreate(tableName).run();
} catch (e) {
if (!e.message.includes('already exists'))
_.log(e);
}
},
getAsyncIgnoreCase: async function (table, key) {
const res = await r.table(table)
.filter(doc => doc('id').match(`(?i)^${key}$`))
......
......@@ -28,6 +28,14 @@ module.exports = {
cbReady();
}, this);
},
createTable: async function (tableName) {
return new Promise(res => {
this.db.run(`
CREATE TABLE ${tableName} (key VARCHAR(50), value TEXT)
`, res);
});
},
onTableCreated: async function (table) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment