Files
gongxue-base/apps/server/src/main.ts
wangziqi 990c0c16e6 feat: Docker Compose deployment + auto migration on startup
- docker-compose.yml: 移除 MySQL 容器,连宿主机 MySQL
- main.ts: 启动前通过独立 DataSource 执行 runMigrations
- migration-runner.ts: 独立 migration 执行器
- app.module.ts: TypeORM 配置增加 migrations
- 修复 InitialSchema 中 room_expenses 和 financial_operations 重复索引
2026-07-20 12:43:13 +08:00

16 lines
504 B
TypeScript

import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { AppModule } from './app.module';
import { runMigrationsOnStartup } from './migration-runner';
async function bootstrap() {
await runMigrationsOnStartup();
const app = await NestFactory.create(AppModule);
app.setGlobalPrefix('api');
app.enableCors();
await app.listen(process.env.PORT ?? 3000);
console.log(`Server running on http://localhost:${process.env.PORT ?? 3000}`);
}
bootstrap();