mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
35 lines
752 B
TypeScript
35 lines
752 B
TypeScript
import { DataSource } from "typeorm";
|
|
import {
|
|
Game,
|
|
GameShopCache,
|
|
ImageCache,
|
|
Repack,
|
|
RepackerFriendlyName,
|
|
UserPreferences,
|
|
MigrationScript,
|
|
SteamGame,
|
|
} 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,
|
|
SteamGame,
|
|
],
|
|
...options,
|
|
});
|
|
|
|
export const dataSource = createDataSource({
|
|
synchronize: true,
|
|
});
|