-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add --generator option to generate cmd (#16452)
Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com> Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com> Co-authored-by: Alexey Orlenko <alex@aqrln.net>
- Loading branch information
1 parent
f4a7eba
commit 1ea1511
Showing
7 changed files
with
208 additions
and
1 deletion.
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
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
16 changes: 16 additions & 0 deletions
16
packages/cli/src/__tests__/commands/__snapshots__/Generate.test.ts.snap
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
44 changes: 44 additions & 0 deletions
44
packages/cli/src/__tests__/fixtures/example-project/prisma/multiple-generator.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,44 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
output = "../generated/client" | ||
} | ||
|
||
generator client_2 { | ||
provider = "prisma-client-js" | ||
output = "../generated/client_2" | ||
} | ||
|
||
generator client_3 { | ||
provider = "prisma-client-js" | ||
output = "../generated/client_3" | ||
} | ||
|
||
datasource db { | ||
provider = "sqlite" | ||
url = "file:dev.db" | ||
} | ||
|
||
model Post { | ||
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 Post[] | ||
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
21 changes: 21 additions & 0 deletions
21
packages/internals/src/__tests__/getGenerators/multiple-generators-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,21 @@ | ||
datasource db { | ||
provider = "sqlite" | ||
url = "file:./dev.db" | ||
} | ||
|
||
generator client_1 { | ||
provider = "predefined-generator-1" | ||
} | ||
|
||
generator client_2 { | ||
provider = "predefined-generator-2" | ||
} | ||
|
||
generator client_3 { | ||
provider = "predefined-generator-3" | ||
} | ||
|
||
model User { | ||
id Int @id | ||
name String | ||
} |
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