Allow to access `DataSource` instance after initialized with `TypeOrmModule.forRoot`
tsugitta opened this issue · comments
Toshinori Tsugita commented
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
When the application has finished initializing the DataSource to be used, it may be necessary to perform some processing using that DataSource.
typeorm-transactional requires such a step.
It's possible with TypeOrmModule.forRootAsync
like below:
TypeOrmModule.forRootAsync({
dataSourceFactory: async (options) => {
const dataSource = await new DataSource(options).initialize();
// some processes using `dataSource`
// ..
return dataSource;
}
})
However, it seems impossible with TypeOrmModule.forRoot
.
Describe the solution you'd like
add a new callback option.
TypeOrmModule.forRoot({
onDataSourceInitialized: async (dataSource) => {
// some processes using `dataSource`
}
})
Teachability, documentation, adoption, migration strategy
N/A
What is the motivation / use case for changing the behavior?
written in Is your feature request related to a problem? Please describe it
.
Kamil Mysliwiec commented
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.