|
|
@@ -21,8 +21,12 @@ export class IntegrationTestDatabase {
|
|
|
* 获取当前数据源
|
|
|
*/
|
|
|
static async getDataSource(): Promise<DataSource> {
|
|
|
+ if (!AppDataSource) {
|
|
|
+ initializeDataSource([UserEntity, Role]);
|
|
|
+ }
|
|
|
+
|
|
|
if (!AppDataSource.isInitialized) {
|
|
|
- await initializeDataSource([UserEntity, Role]);
|
|
|
+ await AppDataSource.initialize();
|
|
|
}
|
|
|
return AppDataSource;
|
|
|
}
|