22 lines
549 B
TypeScript
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();
|
|
}
|
|
}
|