webdev-service-backend / check-db.ts
underrate's picture
Initial commit
d53e5b4 verified
raw
history blame contribute delete
555 Bytes
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
console.log("Fetching all blog posts...");
const posts = await prisma.blogPost.findMany();
console.log(`Total posts in DB: ${posts.length}`);
if (posts.length > 0) {
console.log("First post sample:", JSON.stringify(posts[0], null, 2));
} else {
console.log("No posts found. Seed failed or ran on wrong DB?");
}
}
main()
.catch(console.error)
.finally(() => prisma.$disconnect());