Skip to content

Latest commit

 

History

History

update-delete-ignore-not-found

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Prisma Client Extension - Update and Delete ignore on not found

This example adds the updateIgnoreOnNotFound and deleteIgnoreOnNotFound methods to all your models. The two methods allow you to return null if a record is not found when updating or deleting a record instead of throwing an error.

Please read the documentation on model extensions for more information.

How to use

Prerequisites

1. Download example & install dependencies

Clone this repository:

git clone [email protected]:prisma/prisma-client-extensions.git

Install dependencies:

cd update-delete-ignore-not-found
npm install

2. Create an SQLite database and run migrations

Run the following command to create a SQLite database and seed your database with sample data:

npx prisma migrate dev

3. Run the dev script

To run the script.ts file, run the following command:

npm run dev