igcrmapi/migrate_stages.js

15 lines
646 B
JavaScript

const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function main() {
console.log('Migrating Opportunity stages...');
await prisma.$executeRaw`UPDATE opportunity SET stage = 'WON' WHERE stage = 'SALES'`; // In case we already pushed and it's mixed
// Actually we want to go from WON to SALES
// But since WON is being removed, we should do it after schema change if we use executeRaw
// But wait, if I use executeRaw, I can do it before schema change if SALES is not in enum yet? No.
// Let's just try to push and see. If it fails, I'll do a more manual approach.
}
main();