init simple appreports

This commit is contained in:
2020-07-29 20:56:03 +02:00
parent 217775265f
commit 4296f42ee7
24 changed files with 1568 additions and 256 deletions

26
lib/db/index.js Normal file
View File

@ -0,0 +1,26 @@
'use strict';
const knex = require ('knex');
let db = null;
async function init (use_fake_seed) {
db = knex ({
client: 'sqlite',
connection: { filename: 'db.sqlite' },
migrations: { directory: 'migrations' },
seeds: { directory: 'seeds' },
useNullAsDefault: true
});
await db.migrate.latest ();
if (use_fake_seed)
await db.seed.run ({ specific: 'fake.js' });
}
function get_all () {
return db ('log')
.select ();
}
module.exports = { init, get_all };