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