import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; import { adapterLegacy } from 'prisma.config.legacy'; import { PrismaClient } from 'prisma/prisma-legacy/generated/prisma/client/legacy/client'; @Injectable() export class PrismaLegacyService extends PrismaClient implements OnModuleInit, OnModuleDestroy { readonly client: PrismaClient; constructor() { super({adapter: adapterLegacy}) } async onModuleInit() { await this.$connect(); } async onModuleDestroy() { await this.$disconnect(); } }