This example uses an extension to obfuscate a sensitive password
field on a User
model. The password
column is not included in selected columns in the underlying SQL queries, and it will resolve to undefined
when accessed on a user result object. It could also resolve to any other value, such as an obfuscated string like "********"
.
This extension is provided as an example only. It is not intended to be used in production environments.
Please read the documentation on result
extensions for more information.
- Install Node.js
Clone this repository:
git clone [email protected]:sbking/prisma-client-extensions.git
Install dependencies:
cd obfuscated-fields
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