mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
first commit
This commit is contained in:
commit
992ec5ab49
145 changed files with 37479 additions and 0 deletions
33
src/main/data-source.ts
Normal file
33
src/main/data-source.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { DataSource } from "typeorm";
|
||||
import {
|
||||
Game,
|
||||
GameShopCache,
|
||||
ImageCache,
|
||||
Repack,
|
||||
RepackerFriendlyName,
|
||||
UserPreferences,
|
||||
MigrationScript,
|
||||
} from "@main/entity";
|
||||
import type { SqliteConnectionOptions } from "typeorm/driver/sqlite/SqliteConnectionOptions";
|
||||
|
||||
import { databasePath } from "./constants";
|
||||
|
||||
export const createDataSource = (options: Partial<SqliteConnectionOptions>) =>
|
||||
new DataSource({
|
||||
type: "sqlite",
|
||||
database: databasePath,
|
||||
entities: [
|
||||
Game,
|
||||
ImageCache,
|
||||
Repack,
|
||||
RepackerFriendlyName,
|
||||
UserPreferences,
|
||||
GameShopCache,
|
||||
MigrationScript,
|
||||
],
|
||||
...options,
|
||||
});
|
||||
|
||||
export const dataSource = createDataSource({
|
||||
synchronize: true,
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue