Files
ospab.host/ospabhost/backend/check_tables.js
2025-12-13 12:53:28 +03:00

31 lines
974 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { prisma } = require('./src/prisma/client');
async function checkTables() {
try {
console.log('Проверка таблиц блога...\n');
// Проверка таблицы Post
try {
const postCount = await prisma.post.count();
console.log('[OK] Таблица Post существует. Записей:', postCount);
} catch (error) {
console.log('[ERROR] Таблица Post НЕ существует:', error.message);
}
// Проверка таблицы Comment
try {
const commentCount = await prisma.comment.count();
console.log('[OK] Таблица Comment существует. Записей:', commentCount);
} catch (error) {
console.log('[ERROR] Таблица Comment НЕ существует:', error.message);
}
} catch (error) {
console.error('Общая ошибка:', error);
} finally {
await prisma.$disconnect();
}
}
checkTables();