Downgraded from sqlite3 to sqlite because of connection function error.

This commit is contained in:
2017-08-23 10:26:23 +02:00
parent daa1915203
commit 56405e54f9
3 changed files with 7 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{ {
"database": { "database": {
"host": "shows.db" "host": "../shows.db"
}, },
"webserver": { "webserver": {
"port": 31459 "port": 31459

View File

@@ -15,6 +15,7 @@
"python-shell": "^0.4.0", "python-shell": "^0.4.0",
"request": "^2.81.0", "request": "^2.81.0",
"request-promise": "^4.2", "request-promise": "^4.2",
"sqlite": "^2.2.1",
"sqlite3": "^2.5.0" "sqlite3": "^2.5.0"
} }
} }

View File

@@ -1,19 +1,20 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const sqlite3 = require('sqlite3'); const sqlite = require('sqlite');
class SqliteDatabase { class SqliteDatabase {
constructor(host) { constructor(host) {
this.host = host; this.host = host;
this.connection = sqlite3; this.connection = sqlite;
// this.schemaDirectory = path.join(__dirname, 'schemas'); // this.schemaDirectory = path.join(__dirname, 'schemas');
} }
connect() { connect() {
return Promise.resolve() return Promise.resolve()
.then(() => new sqlite3.Database(this.host)) .then(() => sqlite.open(this.host))
.then(() => sqlite.exec('pragma foreign_keys = on;'));
} }
all(sql, parameters) { all(sql, parameters) {
@@ -29,4 +30,4 @@ class SqliteDatabase {
} }
} }
module.exports = SqliteDatabase; module.exports = SqliteDatabase;