Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

A library to make Prisma 1 arguments compatible with Prisma 2.

License

Notifications You must be signed in to change notification settings

prisma/binding-argument-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prisma binding argument transform

Converting Prisma 1 arguments to Prisma 2 to make it compatible. More info on how to use this while migrating from Prisma 1 to Prisma 2 in our docs.

Build status

Installation and Usage

Installation

Run yarn add @prisma/binding-argument-transform or npm i @prisma/binding-argument-transform to install it in your project.

Usage

// import { makeWherePrisma2Compatible, makeOrderByPrisma2Compatible } from '@prisma/binding-argument-transform'
const { makeWherePrisma2Compatible, makeOrderByPrisma2Compatible } = require('@prisma/binding-argument-transform')

const resolvers = {
  Query: {
    users: (_, { where, orderBy }) {
      const prisma2Where = makeWherePrisma2Compatible(where)
      const prisma2OrderBy = makeOrderByPrisma2Compatible(orderBy)
      return prisma.user.findMany({
        where: prisma2Where,
        orderBy: prisma2OrderBy,
      })
    }
  }
}

Local Development

npm start or yarn start

Runs the project in development/watch mode. Your project will be rebuilt upon changes.

Your library will be rebuilt if you make edits.

npm run build or yarn build

Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ESM).

npm test or yarn test

Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

About

A library to make Prisma 1 arguments compatible with Prisma 2.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published