Skip to content

Instantly share code, notes, and snippets.

@dodycode
Last active July 15, 2023 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dodycode/570efa5d6a9cde0923d22b4ef9de0e09 to your computer and use it in GitHub Desktop.
Save dodycode/570efa5d6a9cde0923d22b4ef9de0e09 to your computer and use it in GitHub Desktop.
just prisma db thing for remix js..
import { PrismaClient } from "@prisma/client";
let db = new PrismaClient();
declare global {
var __db__: PrismaClient | undefined;
}
if (process.env.NODE_ENV === "production") {
db = new PrismaClient();
} else {
if (!global.__db__) {
global.__db__ = new PrismaClient();
}
db = global.__db__;
db.$connect();
}
export { db };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment