Pārlūkot izejas kodu

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

tags/v0.8.0
Shaun pirms 3 gadiem
vecāks
revīzija
bf287869ac
2 mainītis faili ar 17 papildinājumiem un 0 dzēšanām
  1. +9
    -0
      src/server/db/ioRethink.js
  2. +8
    -0
      src/server/db/ioSqlite.js

+ 9
- 0
src/server/db/ioRethink.js Parādīt failu

@@ -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}$`))


+ 8
- 0
src/server/db/ioSqlite.js Parādīt failu

@@ -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) {


Notiek ielāde…
Atcelt
Saglabāt