2
0

👷 Add convenient script for migrating Stripe prices

This commit is contained in:
Baptiste Arnaud
2023-10-20 18:26:42 +02:00
parent be9daee63e
commit 11186d8d29
4 changed files with 150 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
import { PrismaClient } from '@typebot.io/prisma'
import { promptAndSetEnvironment } from './utils'
const getUsage = async () => {
await promptAndSetEnvironment()
const prisma = new PrismaClient({
log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],
})
prisma.$on('query', (e) => {
console.log(e.query)
console.log(e.params)
console.log(e.duration, 'ms')
})
const count = await prisma.result.count({
where: {
typebot: { workspaceId: '' },
hasStarted: true,
createdAt: {
gte: '2023-09-18T00:00:00.000Z',
},
},
})
console.log(count)
}
getUsage()