Linted all database files.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
const configuration = require('src/config/configuration').getInstance();
|
const configuration = require('src/config/configuration').getInstance();
|
||||||
const SqliteDatabase = require('src/database/sqliteDatabase');
|
const SqliteDatabase = require('src/database/sqliteDatabase');
|
||||||
|
|
||||||
const database = new SqliteDatabase(configuration.get('database', 'host'));
|
const database = new SqliteDatabase(configuration.get('database', 'host'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,7 +10,7 @@ const database = new SqliteDatabase(configuration.get('database', 'host'));
|
|||||||
* If the tables already exists, it simply proceeds.
|
* If the tables already exists, it simply proceeds.
|
||||||
*/
|
*/
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(() => database.connect())
|
.then(() => database.connect())
|
||||||
.then(() => database.setUp());
|
.then(() => database.setUp());
|
||||||
|
|
||||||
module.exports = database;
|
module.exports = database;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class SqliteDatabase {
|
|||||||
*/
|
*/
|
||||||
connect() {
|
connect() {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() => sqlite.open(this.host))
|
.then(() => sqlite.open(this.host))
|
||||||
.then(() => sqlite.exec('pragma foreign_keys = on;'));
|
.then(() => sqlite.exec('pragma foreign_keys = on;'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,10 +73,10 @@ class SqliteDatabase {
|
|||||||
* Tears down the database by running tearDown.sql file in schemas/.
|
* Tears down the database by running tearDown.sql file in schemas/.
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
tearDown() {
|
tearDown() {
|
||||||
const tearDownSchema = this.readSqlFile('tearDown.sql');
|
const tearDownSchema = this.readSqlFile('tearDown.sql');
|
||||||
return this.execute(tearDownSchema);
|
return this.execute(tearDownSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file contents of a SQL file in schemas/.
|
* Returns the file contents of a SQL file in schemas/.
|
||||||
|
|||||||
Reference in New Issue
Block a user