1.0.0 (2018-01-16)
Prisma 1.0.0 (2018-01-16)
Prisma is an open-source GraphQL query engine, turning your database into a GraphQL API. It is based on the query engine used in Graphcool Framework, and comes with a revamped API design.
You can choose to connect to Prisma directly from frontend applications, but most larger applications need a server in front of Prisma to handle business logic.
Features
-
Prisma API
This Prisma API features a powerful GraphQL API. You can read more about the API capabilities in the documentation.
-
Batch Mutations
You can now update or delete many nodes at once using the
updateMany
anddeleteMany
mutations. This is how it could look like for andeleteManyUsers
mutation:mutation { deleteManyUsers( where: { email_contains: "@gmail.com" } ) }
-
Data export and import has been added according to this proposal, you can use it with
prisma export
andprisma import
. -
Transactional nested mutations
This means that if a single mutation fails (for example, due to a violated unique constraint), all mutations part of the nested mutation are not executed. Read this specification for details.
-
Embedded Types and Optional Relation Directives
You can now define unidirectional relations, which enables embedded types. This is now a valid datamodel:
type User { id: ID! @unique name: String! location: Location friends: [User!]! @relation(name: "Friends") } type Location { lat: Float! lng: Float! city: City } type City { name: String! }
- Optional Relation Directives: Note that
location: Location
andcity: City
doesn't have a@relation
directive. - Unidirectional relations: Note that
Location
doesn't have a field of typeUser
, andCity
doesn't have a field of typeLocation
.
- Optional Relation Directives: Note that
-
Subscription support
The Subscription API is hosted at the same endpoints as the DB API, but with the
wss
protocol instead. You can check the GraphQL Server example to see how to expose subscriptions usingprisma-binding
. -
Deployment improvements
- Deployment resilience: All known problems that made deployment stuck have been fixed.
- Deployment Progress Feedback: You'll now receive incremental feedback during a deployment progress:
Applying changes (215/317) ⡿
-
Completely rehauled CLI commands
Run
prisma
to see the new command layout. Two examples:- the
prisma token
command was added, which generates a service token for the current token prisma cluster
commands let you interact with & manage your clusters.
- the
-
GraphQL compliant error handling
API errors now return a GraphQL compliant response, including an error code and a developer-friendly error message.
-
Advanced database seeding
You can now seed a service upon first deploy using a
.graphql
file as further described here. Check the GraphQL Server example to see how this looks like in practice. -
Clusters and Stages
We have re-introduced the cluster and stage properties in
prisma.yml
as described here. This might require a change in theprisma.yml
file you're currently using. Simply add astage
property like so:# prisma.yml service: graphql-boilerplate + stage: dev datamodel: database/datamodel.graphql disableAuth: true
Getting Started
npm install prisma
prisma init
More information here: https://www.prismagraphql.com/docs/quickstart/