better timestamps, adapt default config
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-23 14:31:15 +02:00
parent 714110edb0
commit ade5b933d8
4 changed files with 26 additions and 13 deletions

View File

@ -5,6 +5,8 @@
* Created by Timo Hocker <timo@scode.ovh>, August 2020
*/
/* eslint-disable no-sync */
'use strict';
const knex = require ('knex');
@ -13,14 +15,15 @@ const fs = require ('fs');
let db = null;
async function init (use_fake_seed) {
// eslint-disable-next-line no-sync
if (use_fake_seed && fs.existsSync ('db.sqlite'))
// eslint-disable-next-line no-sync
fs.unlinkSync ('db.sqlite');
if (!fs.existsSync ('data'))
fs.mkdirSync ('data');
if (use_fake_seed && fs.existsSync ('data/db.sqlite'))
fs.unlinkSync ('data/db.sqlite');
db = knex ({
client: 'sqlite',
connection: { filename: 'db.sqlite' },
connection: { filename: 'data/db.sqlite' },
migrations: { directory: 'migrations' },
seeds: { directory: 'seeds' },
useNullAsDefault: true