hydra/src/main/data-source.ts

23 lines
598 B
TypeScript
Raw Normal View History

2024-04-21 05:26:29 +00:00
import { DataSource } from "typeorm";
import {
Game,
GameShopCache,
Repack,
UserPreferences,
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: "better-sqlite3",
database: databasePath,
2024-05-14 15:54:14 +00:00
entities: [Game, Repack, UserPreferences, GameShopCache, SteamGame],
2024-05-14 16:12:19 +00:00
synchronize: true,
2024-04-21 05:26:29 +00:00
...options,
});
2024-05-14 16:12:19 +00:00
export const dataSource = createDataSource({});