How would I add the prisma client as property to the Augment.d.ts?

as the title said. This is how our implementation worked for over a year, but while trying to upgrade all of our deps. there is no prisma client available anymore.
No description
Solution:
I forgot to prisma generate after reinstalling prisma dep haha
Jump to solution
11 Replies
chillihero
chilliheroOP7d ago
I checked in Sykra but somehow i am to stupid to find how you extended the container there
No description
chillihero
chilliheroOP7d ago
okay nvm in the prisma.ts file https://github.com/skyra-project/skyra/blob/a6d3d1120e8962252df4aeafe993a6d8c27c5cc9/src/lib/setup/prisma.ts#L3
container.prisma = prisma;
declare module '@sapphire/pieces' {
interface Container {
prisma: typeof prisma;
}
}
container.prisma = prisma;
declare module '@sapphire/pieces' {
interface Container {
prisma: typeof prisma;
}
}
okay but it looks like skyra should have the same issue, there is no import { PrismaClient } from '@prisma/client'; maybe kyra can help me there
Baylem
Baylem7d ago
What version did you update the dependencies too?
chillihero
chilliheroOP7d ago
I have 5.22, skyra uses 5.17
Baylem
Baylem7d ago
This could be something local, I'm on the latest version of Prisma and Sapphire with no issue with that code. The only difference with mine is I set the client in my Client's constructor
chillihero
chilliheroOP7d ago
let me reinstall the deps
Baylem
Baylem7d ago
Augments.ts
declare module '@sapphire/pieces' {
interface Container {
prisma: PrismaClient;
}
}
declare module '@sapphire/pieces' {
interface Container {
prisma: PrismaClient;
}
}
CustomClient.ts
export class CustomClient extends SapphireClient {
public constructor() {
super(DISCORD_CLIENT_OPTIONS);

// Database
container.prisma = new PrismaClient();
}
export class CustomClient extends SapphireClient {
public constructor() {
super(DISCORD_CLIENT_OPTIONS);

// Database
container.prisma = new PrismaClient();
}
chillihero
chilliheroOP7d ago
bruh
Solution
chillihero
chillihero7d ago
I forgot to prisma generate after reinstalling prisma dep haha
chillihero
chilliheroOP7d ago
devil is in the details
Baylem
Baylem7d ago
hahaha well, glad you got it solved. We all have those days

Did you find this page helpful?