reset-all.ts 844 B

12345678910111213141516171819202122
  1. const { prisma } = require('../src/models');
  2. (async () => {
  3. // Reset all chapters with content to content_completed, clear audio
  4. const r = await prisma.bookChapter.updateMany({
  5. where: { content: { not: null } },
  6. data: { genStage: 'content_completed', audioUrl: '', audioDuration: 0, lrcLyrics: '', contentError: null }
  7. });
  8. console.log(`Reset ${r.count} chapters to content_completed`);
  9. // Also reset book genStages
  10. const br = await prisma.book.updateMany({
  11. where: { genStage: { notIn: ['draft', 'failed', 'outlining'] } },
  12. data: { genStage: 'content_completed' }
  13. });
  14. console.log(`Reset ${br.count} books to content_completed`);
  15. // Show counts
  16. console.log(`TtsTask: ${await prisma.ttsTask.count()}`);
  17. console.log(`AiCallLog: ${await prisma.aiCallLog.count()}`);
  18. await prisma.$disconnect();
  19. })();