-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable prisma previes features via keystone config (#6574)
Co-authored-by: Tim Leslie <[email protected]>
- Loading branch information
1 parent
32c1410
commit 3ee4542
Showing
14 changed files
with
1,014 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@keystone-next/prisma-preview-features': minor | ||
'@keystone-next/keystone': minor | ||
--- | ||
|
||
Enable prisma preview features via keystone config |
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
## Feature Example - Prisma Preview Features | ||
|
||
This project demonstrates how to use the prisma preview features with custom queries . | ||
It builds on the [extend-graphql-schema](../extend-graphql-schema) starter project. | ||
|
||
## Instructions | ||
|
||
To run this project, clone the Keystone repository locally then navigate to this directory and run: | ||
|
||
```shell | ||
yarn dev | ||
``` | ||
|
||
This will start the Admin UI at [localhost:3000](http://localhost:3000). | ||
You can use the Admin UI to create items in your database. | ||
|
||
You can also access a GraphQL Playground at [localhost:3000/api/graphql](http://localhost:3000/api/graphql), which allows you to directly run GraphQL query `exampleWithPrismaPreviewFeatures`. | ||
|
||
## Features | ||
|
||
This project demonstrates how to use the Prisma Preview Features like `orderRelation`. |
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,23 @@ | ||
import { graphQLSchemaExtension } from '@keystone-next/keystone'; | ||
|
||
export const extendGraphqlSchema = graphQLSchemaExtension({ | ||
typeDefs: ` | ||
type Query { | ||
exampleWithPrismaPreviewFeatures: [Task] | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
exampleWithPrismaPreviewFeatures: async (root, args, context) => { | ||
const data = await context.prisma.task.findMany({ | ||
orderBy: { | ||
assignedTo: { | ||
name: 'desc', | ||
}, | ||
}, | ||
}); | ||
return data; | ||
}, | ||
}, | ||
}, | ||
}); |
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 { config } from '@keystone-next/keystone'; | ||
import { lists } from './schema'; | ||
import { extendGraphqlSchema } from './custom-schema'; | ||
|
||
export default config({ | ||
db: { | ||
provider: 'sqlite', | ||
url: process.env.DATABASE_URL || 'file:./keystone-example.db', | ||
prismaPreviewFeatures: ['orderByRelation'], | ||
}, | ||
lists, | ||
extendGraphqlSchema, | ||
}); |
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,22 @@ | ||
{ | ||
"name": "@keystone-next/prisma-preview-features", | ||
"version": "0.0.0", | ||
"private": true, | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "keystone-next dev", | ||
"start": "keystone-next start", | ||
"build": "keystone-next build", | ||
"seed-data": "keystone-next --seed-data" | ||
}, | ||
"dependencies": { | ||
"@keystone-next/keystone": "^25.0.0" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.4.3" | ||
}, | ||
"engines": { | ||
"node": "^12.20 || >= 14.13" | ||
}, | ||
"repository": "https://github.com/keystonejs/keystone/tree/master/examples/prisma-preview-features" | ||
} |
Oops, something went wrong.