Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get connection object with multiple databases #869

Closed
temyer opened this issue Mar 21, 2022 · 1 comment
Closed

Get connection object with multiple databases #869

temyer opened this issue Mar 21, 2022 · 1 comment

Comments

@temyer
Copy link

temyer commented Mar 21, 2022

export const databaseProviders: Provider[] = [
    {
        provide: DATABASE_1,
        inject: [ConfigService],
        name: 'db1',
        useFactory: async (configService: ConfigService): Promise<Sequelize> => {
            const sequelize = new Sequelize({
                ...
            });

            sequelize.addModels([
                ...
            ]);

            await sequelize.sync();
            return sequelize;
        },
    },
    {
        provide: DATABASE_2,
        inject: [ConfigService],
        name: 'db2',
        useFactory: async (configService: ConfigService): Promise<Sequelize> => {
            const sequelize = new Sequelize({
                ...
            });

            sequelize.addModels([
                ...
            ]);

            return sequelize;
        },
    },
];

I have the setup above, databaseProviders injected in database module. I want to implement nestjs terminus, but i can't get connection objects to pass in sequelizeHealthIndicator

@kamilmysliwiec
Copy link
Member

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.

@nestjs nestjs locked and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants