🧐 Add deleteChatSession script
This commit is contained in:
28
packages/scripts/deleteChatSession.ts
Normal file
28
packages/scripts/deleteChatSession.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { PrismaClient } from '@typebot.io/prisma'
|
||||
import { promptAndSetEnvironment } from './utils'
|
||||
import * as p from '@clack/prompts'
|
||||
|
||||
const deleteChatSession = async () => {
|
||||
await promptAndSetEnvironment('production')
|
||||
|
||||
const id = await p.text({
|
||||
message: 'Session ID?',
|
||||
})
|
||||
|
||||
if (!id || typeof id !== 'string') {
|
||||
console.log('No ID provided')
|
||||
return
|
||||
}
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
const chatSession = await prisma.chatSession.delete({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
|
||||
console.log(JSON.stringify(chatSession, null, 2))
|
||||
}
|
||||
|
||||
deleteChatSession()
|
Reference in New Issue
Block a user