Skip to content

Latest commit

 

History

History
54 lines (33 loc) · 1.22 KB

File metadata and controls

54 lines (33 loc) · 1.22 KB

Prisma Client Extension - Readonly Client

This example creates a client that only allows read operations like findMany and count, not write operations like create or update. Calling write operations will result in an error at runtime and at compile time with TypeScript.

Caveats

This extension is provided as an example only. It is not intended to be used in production environments.

Please read the documentation on query extensions for more information.

How to use

Prerequisites

1. Download example & install dependencies

Clone this repository:

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

Install dependencies:

cd readonly-client
npm install

2. Create an SQLite database and run migrations

Run the following command. An SQLite database will be created automatically:

npx prisma migrate deploy

3. Seed the database

Run the following command to add seed data to the database:

npx prisma db seed

4. Run the dev script

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

npm run dev