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

20 lines
515 B
TypeScript

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();
}
}