Don't ensure directory exists if :memory: storage is used

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-04-15 11:30:12 +02:00
parent 0075578224
commit 3f048fbd25
@@ -33,7 +33,11 @@ export function createSqliteDatabaseClient(
const knexConfig = buildSqliteDatabaseConfig(dbConfig, overrides);
// If storage on disk is used, ensure that the directory exists
if ((knexConfig.connection as Knex.Sqlite3ConnectionConfig).filename) {
if (
(knexConfig.connection as Knex.Sqlite3ConnectionConfig).filename &&
(knexConfig.connection as Knex.Sqlite3ConnectionConfig).filename !==
':memory:'
) {
const { filename } = knexConfig.connection as Knex.Sqlite3ConnectionConfig;
const directory = path.dirname(filename);