prisma-binding to Nexus
Overview
Note: This guide is not fully up-to-date as it currently uses the deprecated version of the
nexus-plugin-prisma
. While this is still functional, it is recommended to use the newnexus-prisma
library or an alternative code-first GraphQL library like Pothos going forward. If you have any questions, join us on our Discord.
This upgrade guide describes how to migrate a Node.js project that's based on Prisma 1 and uses prisma-binding
to implement a GraphQL server.
The code will be migrated to @nexus/schema
and the nexus-plugin-prisma
. As opposed to the SDL-first approach that's used with prisma-binding
, Nexus follows a code-first approach to construct GraphQL schemas. You can learn about the main differences of these two approaches in this article. If you want to continue using the SDL-first approach, you can follow the guide to upgrade from prisma-binding
to an SDL-first setup.
This guide also explains how to migrate from JavaScript to TypeScript, it therefore basically assumes a full rewrite of your existing app. If you want to keep running your application in JavaScript, you can ignore the instructions that relate to the TypeScript setup keep using JavaScript as before.
The guide assumes that you already went through the guide for upgrading the Prisma ORM layer. This means you already:
- installed the Prisma ORM 2.0 CLI
- created your Prisma ORM 2.0 schema
- introspected your database and resolved potential schema incompatibilities
- installed and generated Prisma Client
The guide further assumes that you have a file setup that looks similar to this:
.