second commit
This commit is contained in:
25
prisma/seed.ts
Normal file
25
prisma/seed.ts
Normal file
@ -0,0 +1,25 @@
|
||||
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)
|
||||
})
|
||||
Reference in New Issue
Block a user