This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import { PrismaClient } from "@prisma/client";
import bcrypt from "bcryptjs";
const prisma = new PrismaClient();
async function main() {
const passwordHash = await bcrypt.hash("kj123456", 10);
await prisma.sysUser.upsert({
where: { username: "admin_demo" },
update: { passwordHash },
create: {
userId: "ADMIN_001",
username: "admin_demo",
passwordHash,
role: "admin",
},
});
console.log("Seed 完成:admin_demo / kj123456");
}
main()
.catch((error) => {
console.error("Seed 失败:", error);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();