Skip to content

DatabaseService

Defined in: core/src/database/database.service.ts:21

Opens and caches Kysely database connections by id, running migrations to latest on first access. A service resolved via the Services container.

new DatabaseService(services): DatabaseService;

Defined in: core/src/database/database.service.ts:25

Parameter Type
services Services

DatabaseService

getInstance<TSchema>(options): Promise<Kysely<TSchema>>;

Defined in: core/src/database/database.service.ts:60

Returns the connection for options.id, creating and migrating it on first use and returning the cached instance thereafter. Throws if the instance could not be created.

Type Parameter
TSchema
Parameter Type
options DatabaseOptions<TSchema>

Promise<Kysely<TSchema>>