Make Docker deploy resilient for Prisma
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { PrismaPg } from "@prisma/adapter-pg";
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined;
|
||||
@@ -28,12 +29,10 @@ function getPrismaDatabaseUrl() {
|
||||
export const db =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
adapter: new PrismaPg({
|
||||
connectionString: getPrismaDatabaseUrl(),
|
||||
}),
|
||||
log: ["error"],
|
||||
datasources: {
|
||||
db: {
|
||||
url: getPrismaDatabaseUrl(),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
globalForPrisma.prisma = db;
|
||||
|
||||
Reference in New Issue
Block a user