traintrape-moi/server/prisma/seed.ts

27 lines
537 B
TypeScript
Raw Normal View History

2024-12-07 09:24:41 +00:00
import { PrismaClient } from '@prisma/client'
2024-12-07 09:24:41 +00:00
const prisma = new PrismaClient()
async function main() {
const emmy = await prisma.user.upsert({
where: { id: 1 },
update: { name: 'Emmy' },
create: { name: 'Emmy' },
2024-12-07 09:24:41 +00:00
})
const tamina = await prisma.user.upsert({
where: { id: 2 },
update: { name: 'Tamina' },
create: { name: 'Tamina' },
2024-12-07 09:24:41 +00:00
})
console.log({ emmy, tamina })
}
main()
.catch((e) => {
2024-12-07 09:24:41 +00:00
console.error(e)
process.exit(1)
})
.finally(async () => {
2024-12-07 09:24:41 +00:00
await prisma.$disconnect()
})