28 lines
519 B
JavaScript
28 lines
519 B
JavaScript
![]() |
import { PrismaClient } from '@prisma/client'
|
||
|
|
||
|
const prisma = new PrismaClient()
|
||
|
|
||
|
const userData = [
|
||
|
]
|
||
|
|
||
|
async function main() {
|
||
|
console.log(`Start seeding ...`)
|
||
|
for (const u of userData) {
|
||
|
const user = await prisma.user.create({
|
||
|
data: u,
|
||
|
})
|
||
|
console.log(`Created user with id: ${user.id}`)
|
||
|
}
|
||
|
console.log(`Seeding finished.`)
|
||
|
}
|
||
|
|
||
|
main()
|
||
|
.then(async () => {
|
||
|
await prisma.$disconnect()
|
||
|
})
|
||
|
.catch(async (e) => {
|
||
|
console.error(e)
|
||
|
await prisma.$disconnect()
|
||
|
process.exit(1)
|
||
|
})
|