26 lines
492 B
TypeScript
26 lines
492 B
TypeScript
import { PrismaClient } from '@prisma/client'
|
|
import { hash } from 'bcryptjs'
|
|
|
|
const prisma = new PrismaClient()
|
|
|
|
async function main() {
|
|
const password = await hash('password', 10)
|
|
const user = await prisma.user.create({
|
|
data: {
|
|
email: 'test@example.com',
|
|
password,
|
|
},
|
|
})
|
|
console.log({ user })
|
|
}
|
|
|
|
main()
|
|
.then(async () => {
|
|
await prisma.$disconnect()
|
|
})
|
|
.catch(async (e) => {
|
|
console.error(e)
|
|
await prisma.$disconnect()
|
|
process.exit(1)
|
|
})
|