/home/techb158/cosmic-risk.abdallabala.com/prisma
NameSizeModeActions
add-membership.js9970644editdlrm
check-counts.js5260644editdlrm
check-org.js5440644editdlrm
check-project.js4020644editdlrm
cleanup-dups.js19140644editdlrm
import-project.js113250644editdlrm
list-projects.js2650644editdlrm
schema.prisma180360644editdlrm
seed-import.json1709830644editdlrm
seed.js177900644editdlrm
Edit: /home/techb158/cosmic-risk.abdallabala.com/prisma/cleanup-dups.js (1914B)
const{PrismaClient}=require('@prisma/client');const p=new PrismaClient(); (async()=>{ const proj = await p.project.findFirst({ where: { name: 'Retail Customer Support GenAI Assistant' } }); if (proj) { // Delete duplicate projects and their related data const dups = await p.project.findMany({ where: { name: 'Retail Customer Support GenAI Assistant', id: { not: proj.id } } }); for (const d of dups) { await p.gateCriterion.deleteMany({ where: { gate: { projectId: d.id } } }).catch(()=>{}); await p.gateEvaluation.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.modelMetric.deleteMany({ where: { experiment: { projectId: d.id } } }).catch(()=>{}); await p.experiment.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.indicator.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.evidence.deleteMany({ where: { mitigation: { risk: { projectId: d.id } } } }).catch(()=>{}); await p.mitigation.deleteMany({ where: { risk: { projectId: d.id } } }).catch(()=>{}); await p.risk.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.lifecyclePhase.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.reportExport.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.auditEvent.deleteMany({ where: { projectId: d.id } }).catch(()=>{}); await p.project.delete({ where: { id: d.id } }).catch(()=>{}); console.log('Cleaned duplicate:', d.id); } } console.log('Projects now:', await p.project.count()); console.log('Risks now:', await p.risk.count()); console.log('Mitigations now:', await p.mitigation.count()); console.log('Indicators now:', await p.indicator.count()); console.log('Experiments now:', await p.experiment.count()); console.log('Gates now:', await p.gateEvaluation.count()); await p.$disconnect() })()