This example demonstrates a Prisma Client extension which adds reusable filters for a model which can be composed and passed to a where
condition. Complex, frequently used filtering conditions can be written once and accessed in many queries through the extended Prisma Client instance.
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 git@github.com:sbking/prisma-client-extensions.git
Install dependencies:
cd model-filters
npm install
Run the following command. An SQLite database will be created automatically:
npx prisma migrate deploy
Run the following command to add seed data to the database:
npx prisma db seed
To run the script.ts
file, run the following command:
npm run dev