diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0c09e6c..337e149 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,7 +112,7 @@ This project uses [Husky](https://github.com/typicode/husky) to define git hooks ### Database -The application uses [SQLite3](https://www.npmjs.com/package/sqlite3) as a database, with [TypeORM](https://typeorm.io) as an object-relation mapper. +The application uses [SQLite3](https://www.npmjs.com/package/better-sqlite3) as a database, with [TypeORM](https://typeorm.io) as an object-relation mapper. #### Database Migrations diff --git a/ormconfig.yml b/ormconfig.yml index 7e8cf3e..347b1e4 100644 --- a/ormconfig.yml +++ b/ormconfig.yml @@ -1,7 +1,8 @@ # this file is only meant to generate migrations via the cli +# keep it up to date with src/main/core/database.ts library: - type: sqlite + type: better-sqlite3 database: ./test-paths/typeorm/library.db cache: true entities: @@ -12,7 +13,7 @@ library: migrationsDir: ./src/main/migrations/library store: - type: sqlite + type: better-sqlite3 database: ./test-paths/typeorm/store.db cache: true entities: diff --git a/src/main/core/database.ts b/src/main/core/database.ts index 0ec88f1..29ca1a1 100644 --- a/src/main/core/database.ts +++ b/src/main/core/database.ts @@ -12,6 +12,9 @@ type MyConnectionOptions = { [key in Database]: BetterSqlite3ConnectionOptions } const databaseDir = path.resolve(appPath, 'database'); +/** + * @see ormconfig.yml in the root folder + */ function getConnectionOptionsFor(database: Database): BetterSqlite3ConnectionOptions { return { name: database,