30 lines
589 B
TypeScript
30 lines
589 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
import * as bcrypt from "bcryptjs";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const senhaHash = await bcrypt.hash("34641747", 10);
|
|
|
|
await prisma.usuario.upsert({
|
|
where: { email: "rodrigo@advx.com" },
|
|
update: {},
|
|
create: {
|
|
email: "rodrigo@advx.com",
|
|
nome: "Rodrigo",
|
|
senha: senhaHash,
|
|
cargo: "admin",
|
|
dataCriacao: new Date(),
|
|
},
|
|
});
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|