This example demonstrates how to create a Prisma Client extension that adds signUp()
and findManyByDomain()
methods to a User
model.
This technique can be used to abstract the logic for common queries / operations, create repository-like interfaces, or do anything you might do with a static class method.
This extension is provided as an example only. It is not intended to be used in production environments.
Please read the documentation on model
extensions for more information.
- Install Node.js
Clone this repository:
git clone [email protected]:sbking/prisma-client-extensions.git
Install dependencies:
cd static-methods
npm install
Run the following command. An SQLite database will be created automatically:
npx prisma migrate deploy
To run the script.ts
file, run the following command:
npm run dev