targo-backend/prisma/prisma-legacy/prisma-legacy.service.ts

22 lines
549 B
TypeScript

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