mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 06:11:15 +00:00
The custom generator output to src/generated/prisma caused persistent Turbopack module resolution failures in CI. Switch to the standard @prisma/client import path which all bundlers resolve correctly. - Remove custom output from prisma schema generator - Update all imports from ../generated/prisma to @prisma/client - Add postinstall script to auto-run prisma generate after npm ci - Remove generated files from git (no longer needed in source tree) - Simplify CI workflow (remove verify step and --webpack workaround) Co-Authored-By: Claude <noreply@anthropic.com>
18 lines
534 B
TypeScript
18 lines
534 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
import pg from "pg";
|
|
|
|
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
|
|
|
|
function createPrismaClient() {
|
|
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
|
const adapter = new PrismaPg(pool);
|
|
return new PrismaClient({ adapter });
|
|
}
|
|
|
|
export const prisma = globalForPrisma.prisma || createPrismaClient();
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
globalForPrisma.prisma = prisma;
|
|
}
|