can i access sequelize from outside the database provider writing raw query in nestjs using sequelize
export const databaseProviders = [
{
provide: 'Sequelize',
useFactory: async () => {
const sequelize = new Sequelize({
dialect: 'postgres',
host: process.env.PG_HOST,
port: Number(process.env.PG_PORT),
database: process.env.PG_DATABASE,
username: process.env.PG_USERNAME,
password: process.env.PG_PASSWORD,
});
sequelize.addModels([OrderModule]);
await sequelize.sync();
return sequelize;
},
},
];
Can I access the sequelize outside the file, so that i can use raw queries? Is there decorator or something which i can use to access the sequelize to write the raw queries.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/E6cCouG
Comments
Post a Comment