Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client): allow pick as model name (#5122)
- Loading branch information
1 parent
9c11e19
commit 85e4a2e
Showing
5 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
33 changes: 33 additions & 0 deletions
33
src/packages/client/src/__tests__/types/pick/schema.prisma
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "sqlite" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model Pick { | ||
id Int @id @default(autoincrement()) | ||
createdAt DateTime @default(now()) | ||
title String | ||
content String? | ||
published Boolean @default(false) | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId Int | ||
} | ||
|
||
model Profile { | ||
id Int @id @default(autoincrement()) | ||
bio String? | ||
user User @relation(fields: [userId], references: [id]) | ||
userId Int @unique | ||
} | ||
|
||
model User { | ||
id Int @id @default(autoincrement()) | ||
email String @unique | ||
name String? | ||
posts Pick[] | ||
profile Profile? | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { PrismaClient } from '@prisma/client' | ||
|
||
async function main() { | ||
const prisma = new PrismaClient() | ||
|
||
const data = await prisma.pick.findFirst({ | ||
include: { | ||
author: true, | ||
}, | ||
}) | ||
|
||
data?.author.id | ||
|
||
console.log(data) | ||
prisma.$disconnect() | ||
} | ||
|
||
main() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"module": "commonjs", | ||
"strict": true, | ||
"esModuleInterop": true | ||
} | ||
} |
This file contains 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