Experimental SQLite support

This commit is contained in:
2022-09-30 11:42:13 -05:00
parent c0595f3ef9
commit 52762bd4a1
16 changed files with 1401 additions and 71 deletions

View File

@@ -6,6 +6,7 @@ import {Unit} from '../../lifecycle/Unit'
import {Config} from '../../service/Config'
import {Logging} from '../../service/Logging'
import {MigratorFactory} from '../migrations/MigratorFactory'
import {SQLiteConnection} from '../connection/SQLiteConnection'
/**
* Application unit responsible for loading and creating database connections from config.
@@ -48,6 +49,8 @@ export class Database extends Unit {
let conn
if ( config?.dialect === 'postgres' ) {
conn = <PostgresConnection> this.app().make(PostgresConnection, key, config)
} else if ( config?.dialect === 'sqlite' ) {
conn = <SQLiteConnection> this.app().make(SQLiteConnection, key, config)
} else {
const e = new ErrorWithContext(`Invalid or missing database dialect: ${config.dialect}. Should be one of: postgres`)
e.context = { connectionName: key }