001project_wildgrowth/backend/deploy/check-notes-table.js

31 lines
823 B
JavaScript
Raw Permalink Normal View History

2026-02-11 15:26:03 +08:00
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function checkNotesTable() {
try {
const result = await prisma.$queryRaw`
SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_name = 'notes'
ORDER BY ordinal_position
`;
console.log('Notes table columns:');
console.log(JSON.stringify(result, null, 2));
// Check if table exists
const tableExists = await prisma.$queryRaw`
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_name = 'notes'
)
`;
console.log('\nTable exists:', tableExists[0].exists);
} catch (error) {
console.error('Error:', error.message);
} finally {
await prisma.$disconnect();
}
}
checkNotesTable();