subman-nextjs/prisma/script.js

28 lines
530 B
JavaScript
Raw Permalink Normal View History

2024-06-11 13:35:56 +00:00
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
// ... you will write your Prisma Client queries here
const story = await prisma.story.update({
where: { id: 1 },
data: {
title: "Ghost Aliens of Mars",
genres: { set: [{ id: 1 }, { id: 2 }], create: { name: "alien-punk" } }
}
})
console.log(story)
}
main()
.then(async () => {
await prisma.$disconnect()
})
.catch(async (e) => {
console.error(e)
await prisma.$disconnect()
process.exit(1)
})