27 lines
546 B
TypeScript
27 lines
546 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const emmy = await prisma.user.upsert({
|
|
where: { id: 1 },
|
|
update: { name: 'Emmy' },
|
|
create: { name: 'Emmy' },
|
|
});
|
|
const tamina = await prisma.user.upsert({
|
|
where: { id: 2 },
|
|
update: { name: 'Tamina' },
|
|
create: { name: 'Tamina' },
|
|
});
|
|
console.log({ emmy, tamina });
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|