mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-06-07 16:39:46 +08:00
disable synchronize when typeorm db init, all schema change depend on migration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import "reflect-metadata";
|
||||
import { type DataSource } from "typeorm";
|
||||
import { requireTypeorm } from "./utils/module-loader";
|
||||
import fs from 'node:fs'
|
||||
|
||||
import { BossInfo } from "./entity/BossInfo";
|
||||
import { BossInfoChangeLog } from "./entity/BossInfoChangeLog";
|
||||
@@ -33,7 +34,7 @@ export function initDb(dbFilePath) {
|
||||
const { DataSource } = requireTypeorm()
|
||||
const appDataSource = new DataSource({
|
||||
type: "sqlite",
|
||||
synchronize: true,
|
||||
synchronize: !fs.existsSync(dbFilePath),
|
||||
logging: true,
|
||||
logger: "simple-console",
|
||||
database: dbFilePath,
|
||||
|
||||
Reference in New Issue
Block a user