feat: 数据库迁移支持
Some checks failed
Deploy to K3s / deploy (push) Failing after 3m52s

This commit is contained in:
2025-12-20 19:58:47 +08:00
parent 59529519e3
commit d3a7d03be7
7 changed files with 87 additions and 15 deletions

View File

@@ -0,0 +1,20 @@
import 'reflect-metadata';
import { DataSource } from 'typeorm';
import * as dotenv from 'dotenv';
dotenv.config();
export const AppDataSource = new DataSource({
type: 'postgres',
host: process.env.DATABASE_HOST,
port: Number(process.env.DATABASE_PORT ?? 5432),
username: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME,
synchronize: false,
logging: false,
entities: ['dist/**/*.entity.js'],
migrations: ['dist/migrations/*.js'],
});