feat: remove synchronize true from typeorm

This commit is contained in:
Zamitto 2024-08-19 12:42:05 -03:00
parent 5101684154
commit 5369274c6e
7 changed files with 87 additions and 89 deletions

View file

@ -8,30 +8,22 @@ import {
UserPreferences,
UserAuth,
} from "@main/entity";
import type { BetterSqlite3ConnectionOptions } from "typeorm/driver/better-sqlite3/BetterSqlite3ConnectionOptions";
import { databasePath } from "./constants";
import migrations from "./migrations";
import * as migrations from "./migrations";
export const createDataSource = (
options: Partial<BetterSqlite3ConnectionOptions>
) =>
new DataSource({
type: "better-sqlite3",
entities: [
Game,
Repack,
UserPreferences,
GameShopCache,
DownloadSource,
DownloadQueue,
UserAuth,
],
synchronize: true,
database: databasePath,
...options,
});
export const dataSource = createDataSource({
export const dataSource = new DataSource({
type: "better-sqlite3",
entities: [
Game,
Repack,
UserPreferences,
GameShopCache,
DownloadSource,
DownloadQueue,
UserAuth,
],
synchronize: true,
database: databasePath,
migrations,
});