Bugfix: Reference db_template currectly when initialising the db connection
This commit is contained in:
parent
bd08aae1da
commit
08a4ebe9f1
1 changed files with 3 additions and 2 deletions
|
@ -1,13 +1,14 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
import Database from 'better-sqlite3';
|
import Database from 'better-sqlite3';
|
||||||
|
|
||||||
var db = null;
|
var db = null;
|
||||||
|
|
||||||
function init({ settings: { database: { filename, options } } }) {
|
function init({ root_dir, settings: { database: { filename, options } } }) {
|
||||||
db = new Database(filename, options);
|
db = new Database(filename, options);
|
||||||
db.exec(fs.readFileSync("../db_template.sql", "utf8"));
|
db.exec(fs.readFileSync(path.join(root_dir, "./db_template.sql"), "utf8"));
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue