Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctrlplusb/prisma2-template
A scratchpad for Prisma2
https://github.com/ctrlplusb/prisma2-template
Last synced: about 2 months ago
JSON representation
A scratchpad for Prisma2
- Host: GitHub
- URL: https://github.com/ctrlplusb/prisma2-template
- Owner: ctrlplusb
- Created: 2019-12-13T11:20:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T17:05:17.000Z (about 2 years ago)
- Last Synced: 2024-10-04T16:26:25.851Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.25 MB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-prisma - Prisma 2 Scratchpad
README
# Prisma 2 Scratchpad
This is a template for Prisma 2 is intended to allow rapid schema experimentation / development.
Any time you make a change to your Prisma schema the SQLite DB will be destroyed and rebuilt utilising the new schema definition. Any data that you may have inserted into the database will be lost with any change that you make to the schema. After the database is migrated to match the schema the Photon instance will also be regenerated.
In addition to this the Nexus GraphQL schema are also configured to automatically regenerate any time their associated files change. restart the server when you make changes to your Prisma schema, Nexus schema, or server source files.
The GraphQL playground should be available to you in the browser. You may need to refresh the browser preview panel if you would like the GraphQL Playground to load the latest version of the GraphQL Schema to help with code completion etc.
## Example queries
Create a post:
```graphql
mutation {
createOnePost(
data: {
title: "My post"
content: "Lorem ipsum"
category: { create: { name: "Examples" } }
}
) {
title
}
}
```Query for posts:
```graphql
query {
posts {
title
category {
name
}
}
}
```## Running locally
Clone the repo and install deps:
```
git clone https://github.com/ctrlplusb/prisma2-template
cd prisma2-template
yarn install
```Start the development server:
```
yarn develop
```