From 2c1edc26afe73192a5aa160155e0800e1bd92c61 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 24 Jan 2026 19:41:44 -0800 Subject: [PATCH] fix(conversation): disable synchronize in production Use init-db.sql for schema management instead of TypeORM auto-sync. synchronize:true is dangerous in production and causes conflicts when multiple services share tables. Co-Authored-By: Claude Opus 4.5 --- packages/services/conversation-service/src/app.module.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/services/conversation-service/src/app.module.ts b/packages/services/conversation-service/src/app.module.ts index aa53e22..0e96585 100644 --- a/packages/services/conversation-service/src/app.module.ts +++ b/packages/services/conversation-service/src/app.module.ts @@ -25,8 +25,8 @@ import { HealthModule } from './health/health.module'; password: configService.get('POSTGRES_PASSWORD'), database: configService.get('POSTGRES_DB', 'iconsulting'), entities: [__dirname + '/**/*.entity{.ts,.js}'], - // 自动同步数据库schema - 确保Entity与数据库100%一致 - synchronize: true, + // 生产环境禁用synchronize,使用init-db.sql初始化schema + synchronize: false, logging: configService.get('NODE_ENV') === 'development', }), }),