feat: migrating to electron-vite

This commit is contained in:
Hydra 2024-04-21 06:26:29 +01:00
commit 1db5a9c295
183 changed files with 18535 additions and 0 deletions

35
src/main/data-source.ts Normal file
View file

@ -0,0 +1,35 @@
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: "better-sqlite3",
database: databasePath,
entities: [
Game,
ImageCache,
Repack,
RepackerFriendlyName,
UserPreferences,
GameShopCache,
MigrationScript,
SteamGame,
],
...options,
});
export const dataSource = createDataSource({
synchronize: true,
});