-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-db-simple.js
More file actions
37 lines (31 loc) · 1 KB
/
test-db-simple.js
File metadata and controls
37 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient({
log: ['query', 'info', 'warn', 'error'],
});
async function testConnection() {
try {
console.log('Testing database connection...');
// Test simple query
const result = await prisma.$queryRaw`SELECT 1 as test`;
console.log('Simple query result:', result);
// Test table existence
try {
const tables = await prisma.$queryRaw`
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name IN ('bot_configurations', 'obs_connections')
LIMIT 5
`;
console.log('Tables found:', tables);
} catch (tableError) {
console.log('Table query error:', tableError.message);
}
console.log('Database connection test completed successfully');
} catch (error) {
console.error('Database connection test failed:', error.message);
} finally {
await prisma.$disconnect();
}
}
testConnection();