diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 15fdb01..d2d8398 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -3,6 +3,7 @@ generator client { provider = "prisma-client-js" + output = "../node_modules/.prisma/client" } datasource db { diff --git a/src/database/prisma.service.ts b/src/database/prisma.service.ts index 4aee782..051603b 100644 --- a/src/database/prisma.service.ts +++ b/src/database/prisma.service.ts @@ -40,6 +40,7 @@ export class PrismaService implements OnModuleInit, OnModuleDestroy { private readonly logger = new Logger(PrismaService.name); + private readonly pool: Pool; constructor(private configService: ConfigService) { const databaseUrl = configService.get('DATABASE_URL'); @@ -62,6 +63,8 @@ export class PrismaService ], }); + this.pool = pool; + // Log database queries in development mode if (process.env.NODE_ENV === 'development') { this.$on('query' as never, (e: QueryEvent) => { @@ -101,6 +104,7 @@ export class PrismaService async onModuleDestroy() { try { await this.$disconnect(); + await this.pool.end(); this.logger.log('Successfully disconnected from database'); } catch (error) { this.logger.error('Error disconnecting from database', error);