Browse Source

meta: add infos about better-sqlite3 and typeorm config

0.x
Xymorot 6 months ago
parent
commit
588486f4da
3 changed files with 7 additions and 3 deletions
  1. +1
    -1
      CONTRIBUTING.md
  2. +3
    -2
      ormconfig.yml
  3. +3
    -0
      src/main/core/database.ts

+ 1
- 1
CONTRIBUTING.md View File

@ -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


+ 3
- 2
ormconfig.yml View File

@ -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:


+ 3
- 0
src/main/core/database.ts View File

@ -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,


Loading…
Cancel
Save