feat: upgrade major dependencies to latest versions
- Prisma 6.19 → 7.7 (driver adapter pattern, prisma.config.ts) - TypeScript 5.9 → 6.0 (ignoreDeprecations, CSS type declarations) - Vitest 3.2 → 4.1 - Pino 9.14 → 10.3 - @types/node 22.x → 25.x All 307 tests pass, typecheck clean, build succeeds. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
import { Injectable, type OnModuleInit, type OnModuleDestroy } from '@nestjs/common';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import pg from 'pg';
|
||||
|
||||
@Injectable()
|
||||
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
|
||||
private pool: pg.Pool;
|
||||
|
||||
constructor() {
|
||||
const pool = new pg.Pool({ connectionString: process.env['DATABASE_URL'] });
|
||||
const adapter = new PrismaPg(pool);
|
||||
super({ adapter });
|
||||
this.pool = pool;
|
||||
}
|
||||
|
||||
async onModuleInit(): Promise<void> {
|
||||
await this.$connect();
|
||||
}
|
||||
|
||||
async onModuleDestroy(): Promise<void> {
|
||||
await this.$disconnect();
|
||||
await this.pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user