import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() async function fixProPlanName() { console.log('šŸ”§ Fixing Pro plan name in database...') try { // ęŸ„ę‰¾å½“å‰ēš„ Pro 儗餐 const currentProPlan = await prisma.subscriptionPlan.findFirst({ where: { OR: [ { name: 'Pro' }, { name: 'pro' }, { id: 'pro' } ] } }) if (!currentProPlan) { console.log('āŒ No Pro plan found in database') return } console.log(`šŸ“‹ Found Pro plan:`) console.log(` - ID: ${currentProPlan.id}`) console.log(` - Current name: "${currentProPlan.name}"`) console.log(` - Display name: ${currentProPlan.displayName}`) // ę›“ę–°åē§°äøŗå°å†™ "pro" if (currentProPlan.name !== 'pro') { console.log('\nšŸ”„ Updating name to "pro"...') const updatedPlan = await prisma.subscriptionPlan.update({ where: { id: currentProPlan.id }, data: { name: 'pro' } }) console.log(`āœ… Successfully updated plan name to: "${updatedPlan.name}"`) } else { console.log('āœ… Plan name is already correct') } // éŖŒčÆę›“ę–° console.log('\nšŸ” Verifying update...') const verifyPlan = await prisma.subscriptionPlan.findFirst({ where: { name: 'pro' } }) if (verifyPlan) { console.log(`āœ… Verification successful: Found plan with name "pro"`) console.log(` - ID: ${verifyPlan.id}`) console.log(` - Display name: ${verifyPlan.displayName}`) console.log(` - Price: $${verifyPlan.price}`) } else { console.log('āŒ Verification failed: No plan found with name "pro"') } } catch (error) { console.error('āŒ Error fixing Pro plan name:', error) throw error } finally { await prisma.$disconnect() } } // čæč”Œäæ®å¤ if (require.main === module) { fixProPlanName() .then(() => { console.log('\nšŸŽ‰ Pro plan name fix completed!') process.exit(0) }) .catch((error) => { console.error('āŒ Fix failed:', error) process.exit(1) }) } export { fixProPlanName }