17 lines
517 B
TypeScript
17 lines
517 B
TypeScript
import { PrismaClient } from "./generated/prisma/client";
|
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
import { Pool } from "pg";
|
|
import { DATABASE_URL } from "../env"
|
|
import { OutputHandler } from "../utils/outputHandler";
|
|
|
|
const pool = new Pool({ connectionString: DATABASE_URL });
|
|
const adapter = new PrismaPg(pool);
|
|
|
|
pool.connect((err, client, release) => {
|
|
if (err)
|
|
return OutputHandler.errorLog("[PG Error]", err.message);
|
|
|
|
release();
|
|
});
|
|
|
|
export const prisma = new PrismaClient({ adapter });
|