Skip to content

Commit d33bb47

Browse files
Josh Calderdcousens
andauthored
Add db.prismaPath configuration (#8307)
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com> Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
1 parent 4887a7c commit d33bb47

120 files changed

Lines changed: 444 additions & 243 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/depend-on-me.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@keystone-6/core': major
3+
---
4+
5+
Removes assumptions about `@prisma/client` output location, with a new `db.prismaPath` configuration option to set where to import the Prisma client from

examples/assets-local/keystone.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { config } from '@keystone-6/core';
2+
import { fixPrismaPath } from '../example-utils';
23
import { lists } from './schema';
34

45
export default config({
56
db: {
67
provider: 'sqlite',
78
url: process.env.DATABASE_URL || 'file:./keystone-example.db',
9+
10+
// WARNING: this is only needed for our monorepo examples, dont do this
11+
...fixPrismaPath,
812
},
913
lists,
1014
storage: {

examples/assets-local/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource sqlite {
99

1010
generator client {
1111
provider = "prisma-client-js"
12-
output = "node_modules/.prisma/client"
12+
output = "node_modules/.myprisma/client"
1313
}
1414

1515
model Post {

examples/assets-s3/keystone.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { config } from '@keystone-6/core';
22
import dotenv from 'dotenv';
3+
import { fixPrismaPath } from '../example-utils';
34
import { lists } from './schema';
45

56
dotenv.config();
@@ -15,6 +16,9 @@ export default config({
1516
db: {
1617
provider: 'sqlite',
1718
url: process.env.DATABASE_URL || 'file:./keystone-example.db',
19+
20+
// WARNING: this is only needed for our monorepo examples, dont do this
21+
...fixPrismaPath,
1822
},
1923
lists,
2024
storage: {

examples/assets-s3/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource sqlite {
99

1010
generator client {
1111
provider = "prisma-client-js"
12-
output = "node_modules/.prisma/client"
12+
output = "node_modules/.myprisma/client"
1313
}
1414

1515
model Post {

examples/auth/keystone.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { config } from '@keystone-6/core';
22
import { statelessSessions } from '@keystone-6/core/session';
33
import { createAuth } from '@keystone-6/auth';
4+
import { fixPrismaPath } from '../example-utils';
45
import { lists } from './schema';
56

67
// WARNING: this example is for demonstration purposes only
@@ -59,6 +60,9 @@ export default withAuth(
5960
db: {
6061
provider: 'sqlite',
6162
url: process.env.DATABASE_URL || 'file:./keystone-example.db',
63+
64+
// WARNING: this is only needed for our monorepo examples, dont do this
65+
...fixPrismaPath,
6266
},
6367
lists,
6468
session,

examples/auth/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource sqlite {
99

1010
generator client {
1111
provider = "prisma-client-js"
12-
output = "node_modules/.prisma/client"
12+
output = "node_modules/.myprisma/client"
1313
}
1414

1515
model User {

examples/custom-admin-ui-logo/keystone.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { config } from '@keystone-6/core';
2+
import { fixPrismaPath } from '../example-utils';
23
import { lists } from './schema';
34

45
export default config({
56
db: {
67
provider: 'sqlite',
78
url: process.env.DATABASE_URL || 'file:./keystone-example.db',
9+
10+
// WARNING: this is only needed for our monorepo examples, dont do this
11+
...fixPrismaPath,
812
},
913
lists,
1014
ui: {},

examples/custom-admin-ui-logo/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource sqlite {
99

1010
generator client {
1111
provider = "prisma-client-js"
12-
output = "node_modules/.prisma/client"
12+
output = "node_modules/.myprisma/client"
1313
}
1414

1515
model Task {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { config } from '@keystone-6/core';
2+
import { fixPrismaPath } from '../example-utils';
23
import { lists } from './schema';
34

45
export default config({
56
db: {
67
provider: 'sqlite',
78
url: process.env.DATABASE_URL || 'file:./keystone-example.db',
9+
10+
// WARNING: this is only needed for our monorepo examples, dont do this
11+
...fixPrismaPath,
812
},
913
lists,
1014
});

0 commit comments

Comments
 (0)