|
|
@@ -10,7 +10,7 @@ type EntityTarget = Function | EntitySchema<any> | string
|
|
|
* @param entities 实体类数组
|
|
|
* @returns DataSource 实例
|
|
|
*/
|
|
|
-export function createDataSource(entities: EntityTarget<any>[]): DataSource {
|
|
|
+export function createDataSource(entities: EntityTarget[]): DataSource {
|
|
|
// 在测试环境下使用测试数据库配置
|
|
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
|
const testDatabaseUrl = process.env.TEST_DATABASE_URL || 'postgresql://postgres:test_password@localhost:5432/test_d8dai';
|
|
|
@@ -49,6 +49,6 @@ export let AppDataSource: DataSource;
|
|
|
* 初始化默认数据源
|
|
|
* @param entities 实体类数组
|
|
|
*/
|
|
|
-export function initializeDataSource(entities: EntityTarget<any>[]): void {
|
|
|
+export function initializeDataSource(entities: EntityTarget[]): void {
|
|
|
AppDataSource = createDataSource(entities);
|
|
|
}
|