My-Weekly-ToDo-List/scripts/verify-schema.ts

38 lines
954 B
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('Verifying Prisma User model...');
// 1. Check if we can select the new fields
// We'll try to find the first user
const user = await prisma.user.findFirst({
select: {
id: true,
email: true,
startHour: true, // This should compile if client is updated
endHour: true
}
});
if (!user) {
console.log('No users found, but schema seems valid if this runs.');
return;
}
console.log('Found user:', user);
console.log('Successfully selected startHour:', user.startHour);
console.log('Successfully selected endHour:', user.endHour);
}
main()
.catch((e) => {
console.error('Error verifying schema:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});