import { PrismaClient } from "@prisma/client";
import { hash } from "bcrypt";
const prisma = new PrismaClient();
export async function main(){
const password = await hash('test', 123)
const user = await prisma.user.upsert({
where: {
email: 'test@test.com'
},
update:{},
create:{
email: 'test@test.com',
name: 'Test User',
password: password
}
})
console.log(user)
}
main()
.then(() => prisma.$disconnect())
.catch(async (e) => {
console.error(e)
await prisma.$disconnect()
process.exit(1)
})
import { PrismaClient } from "@prisma/client";
import { hash } from "bcrypt";
const prisma = new PrismaClient();
export async function main(){
const password = await hash('test', 123)
const user = await prisma.user.upsert({
where: {
email: 'test@test.com'
},
update:{},
create:{
email: 'test@test.com',
name: 'Test User',
password: password
}
})
console.log(user)
}
main()
.then(() => prisma.$disconnect())
.catch(async (e) => {
console.error(e)
await prisma.$disconnect()
process.exit(1)
})