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.
- Install Node.js
Clone this repository:
git clone [email protected]:prisma/prisma-client-extensions.git
Install dependencies:
cd update-delete-ignore-not-found
npm install
Run the following command to create a SQLite database and seed your database with sample data:
npx prisma migrate dev
To run the script.ts
file, run the following command:
npm run dev