Skip to content

Instantly share code, notes, and snippets.

@nmchenry01
Last active August 13, 2020 22:47
Show Gist options
  • Select an option

  • Save nmchenry01/71823671c4b21161d7fdc45378e695ed to your computer and use it in GitHub Desktop.

Select an option

Save nmchenry01/71823671c4b21161d7fdc45378e695ed to your computer and use it in GitHub Desktop.
Nested write example for "Prisma vs. TypeORM"
const nestedWrite = async (prisma: PrismaClient) => {
await prisma.company.create({
data: {
name: 'Globex',
products: {
create: {
name: 'Car',
description: 'A fine automobile',
customers: {
connect: { username: 'Customer1' },
create: { username: 'Customer2', email: 'Customer2@gmail.com' },
},
},
},
},
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment