import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); async function transfer() { // Get target email from CLI args const targetEmail = process.argv[2]; if (!targetEmail) { console.error("❌ Usage: npx tsx scripts/transfer_projects.ts "); process.exit(1); } console.log(`🚚 STARTING MIGRATION to: ${targetEmail}`); // 1. Find Target User const targetUser = await prisma.user.findUnique({ where: { email: targetEmail } }); if (!targetUser) { console.error(`❌ User ${targetEmail} not found. Please register first!`); process.exit(1); } // 2. Update ALL projects to point to this user // (Except maybe "God Mode Test" projects? No, give them everything) const result = await prisma.project.updateMany({ data: { userId: targetUser.id } }); console.log(`✅ SUCCESS: Transferred ${result.count} projects to ${targetEmail}.`); console.log(`🎉 They should now appear in the dashboard.`); await prisma.$disconnect(); } transfer();