diff --git a/references/ai-chat/package.json b/references/ai-chat/package.json index 737b71b0b..45071838a 100644 --- a/references/ai-chat/package.json +++ b/references/ai-chat/package.json @@ -10,6 +10,7 @@ "db:migrate": "prisma migrate dev", "db:push": "prisma db push", "db:generate": "prisma generate", + "db:reset:chats": "prisma db execute --file prisma/reset-chats.sql", "test": "vitest" }, "dependencies": { diff --git a/references/ai-chat/prisma/reset-chats.sql b/references/ai-chat/prisma/reset-chats.sql new file mode 100644 index 000000000..06363e733 --- /dev/null +++ b/references/ai-chat/prisma/reset-chats.sql @@ -0,0 +1,7 @@ +-- Wipe customer-side chat state for a fresh smoke-test slate. +-- Run via `pnpm run db:reset:chats`. +-- Leaves User rows intact (they're upserted by onPreload/onChatStart), +-- but clears every Chat + ChatSession so a chatId from one target +-- (test cloud / local) can't carry stale session/PAT/lastEventId state +-- into the other. +TRUNCATE "Chat", "ChatSession";