2019-05-22 11:28:57 +00:00
|
|
|
"use strict";
|
|
|
|
|
2019-05-22 17:04:46 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
import Database from 'better-sqlite3';
|
2019-05-22 11:28:57 +00:00
|
|
|
|
2019-05-22 17:04:46 +00:00
|
|
|
var db = null;
|
2019-05-22 11:28:57 +00:00
|
|
|
|
2019-05-23 19:10:06 +00:00
|
|
|
async function init({ settings: { database: { filename, options } } }) {
|
2019-05-22 17:04:46 +00:00
|
|
|
db = new Database(filename, options);
|
|
|
|
db.exec(await fs.promises.readFile("../db_template.sql", "utf8"));
|
|
|
|
return db;
|
2019-05-22 11:28:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-23 19:10:06 +00:00
|
|
|
export default init;
|