18 lines
409 B
TypeScript
18 lines
409 B
TypeScript
|
|
import { PrismaClient } from "@prisma/client";
|
||
|
|
|
||
|
|
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();
|