Last active
August 13, 2020 22:47
-
-
Save nmchenry01/71823671c4b21161d7fdc45378e695ed to your computer and use it in GitHub Desktop.
Nested write example for "Prisma vs. TypeORM"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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