18 lines
408 B
TypeScript
18 lines
408 B
TypeScript
import { PrismaClient } from "@prismaclient";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function testConnection() {
|
|
try {
|
|
// Perform a basic database query to test the connection
|
|
await prisma.$connect();
|
|
console.log("Database connection successful!");
|
|
} catch (error) {
|
|
console.error("Failed to connect to the database:", error);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
testConnection();
|