-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add disable flag to prisma config options (#233)
close issue #202 by adding an environment variable friendly approach to disabling the generator
- Loading branch information
Showing
12 changed files
with
71 additions
and
22 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
File renamed without changes.
File renamed without changes.
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,13 @@ | ||
import * as child_process from 'child_process'; | ||
import fs from 'fs'; | ||
|
||
test('disabled-config.prisma', async () => { | ||
const fileName = 'disabled-config.svg'; | ||
const folderName = '__tests__'; | ||
child_process.execSync(`rm -f ${folderName}/${fileName}`); | ||
child_process.execSync( | ||
`npx cross-env prisma generate --schema ./prisma/disabled-config.prisma` | ||
); | ||
const exists = fs.existsSync(`${folderName}/${fileName}`); | ||
expect(exists).toBe(false); | ||
}); |
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,13 @@ | ||
import * as child_process from 'child_process'; | ||
import fs from 'fs'; | ||
|
||
test('disabled-env.prisma', async () => { | ||
const fileName = 'disabled.svg'; | ||
const folderName = '__tests__'; | ||
child_process.execSync(`rm -f ${folderName}/${fileName}`); | ||
child_process.execSync( | ||
`npx cross-env DISABLE_ERD=true prisma generate --schema ./prisma/disabled-env.prisma` | ||
); | ||
const exists = fs.existsSync(`${folderName}/${fileName}`); | ||
expect(exists).toBe(false); | ||
}); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,29 @@ | ||
// This is your Prisma schema file, | ||
// learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
generator erd { | ||
provider = "node ./dist/index.js" | ||
output = "../__tests__/disabled-config.svg" | ||
disabled = true | ||
// debug = true | ||
} | ||
|
||
model Booking { | ||
id Int @id @default(autoincrement()) | ||
inviteeEmail String | ||
startDateUTC DateTime | ||
cancelCode String | ||
events Event[] | ||
} | ||
|
||
model Event { | ||
id Int @id @default(autoincrement()) | ||
name String | ||
startDate DateTime | ||
bookings Booking[] | ||
} |
File renamed without changes.
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
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