We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f93549 commit b61bcfaCopy full SHA for b61bcfa
apps/api/src/prisma.service.ts
@@ -1,8 +1,11 @@
1
-import { Injectable, OnModuleInit } from '@nestjs/common';
+import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
2
import { PrismaClient } from '@prisma/client';
3
4
@Injectable()
5
-export class PrismaService extends PrismaClient implements OnModuleInit {
+export class PrismaService
6
+ extends PrismaClient
7
+ implements OnModuleInit, OnModuleDestroy
8
+{
9
constructor() {
10
super({
11
log:
@@ -15,4 +18,8 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
15
18
async onModuleInit() {
16
19
await this.$connect();
17
20
}
21
+
22
+ async onModuleDestroy() {
23
+ await this.$disconnect();
24
+ }
25
0 commit comments