Jonathan
Jonathan
Explore posts from servers
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
Yeah I have a few thousand active users at a time generally and I am doing something like this in the nextjs app
import { PrismaClient } from "@prisma/client";

import { env } from "@/env";

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};

export const db =
globalForPrisma.prisma ??
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});

if (env.NODE_ENV !== "production") globalForPrisma.prisma = db;
import { PrismaClient } from "@prisma/client";

import { env } from "@/env";

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};

export const db =
globalForPrisma.prisma ??
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});

if (env.NODE_ENV !== "production") globalForPrisma.prisma = db;
8 replies
PPrisma
Created by Jonathan on 6/24/2024 in #help-and-questions
Ensuring Filtering if variable is undefined
Yeah I agree it is a "we have to live with it" but would be nice if there was a better way sometimes I tend to do the second approach
6 replies
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
ok thanks
8 replies
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
ok I will give it a try
8 replies