import { PrismaClient, MediaKind } from '@prisma/client'; const prisma = new PrismaClient({ log: ['query', 'info', 'warn', 'error'], }); async function testInsert() { console.log('Testing GIF insert...\n'); try { // Get first video const video = await prisma.termMedia.findFirst({ where: { kind: MediaKind.VIDEO }, }); if (!video) { console.log('No video found'); return; } console.log(`Found video: ${video.url}`); console.log(`Term ID: ${video.termId}\n`); // Try to insert GIF const gif = await prisma.termMedia.create({ data: { termId: video.termId, kind: MediaKind.GIF, url: '/uploads/gifs/test.gif', }, }); console.log('āœ… GIF created:', gif); // Verify it exists const check = await prisma.termMedia.findUnique({ where: { id: gif.id }, }); console.log('\nāœ… Verification:', check); // Clean up await prisma.termMedia.delete({ where: { id: gif.id } }); console.log('\nāœ… Cleaned up test record'); } catch (error) { console.error('āŒ Error:', error); } finally { await prisma.$disconnect(); } } testInsert();