Skip to content

Instantly share code, notes, and snippets.

@justinbalaguer
Created October 29, 2024 12:04
Show Gist options
  • Save justinbalaguer/648a34d7ae29fdb0439a59618b8f7dcd to your computer and use it in GitHub Desktop.
Save justinbalaguer/648a34d7ae29fdb0439a59618b8f7dcd to your computer and use it in GitHub Desktop.
import db from "./index"
const seed = async () => {
// hashed password = password123
const hashedPassword =
"JGFyZ29uMmlkJHY9MTkkbT02NTUzNix0PTIscD0xJCtCUmJlbXpWTnhRTCtnVUxwZThHNnckaHkySU15OGlVOHp4WEl4VXphbjZRR2JLSUhVNDI1eTQ3azc1WEhxSDE4SQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
const existingUser = await db.user.findFirst({
where: {
email: "[email protected]",
},
})
if (!existingUser) {
await db.user.create({
data: {
name: "Administrator",
email: "[email protected]",
role: "ADMIN",
hashedPassword,
},
})
}
}
export default seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment