prisma-vir
v2.2.4
Published
Helpers for Prisma.
Downloads
1,100
Maintainers
Readme
prisma-vir
Prisma utilities for interacting with migrations, databases, schemas, and creating Prisma clients with optional testing databases (supporting only Postgres and SQLite).
Reference docs: https://electrovir.github.io/prisma-vir
Install
npm i prisma-virClient Usage
Use createPrismaClient to easily create a prisma client in either Postgres or SQLite with automatic configuration for tests.
API Usage
Use prismaApi to run Prisma commands as an API.
Generators Usage
This package exposes the following generators:
prisma-shapes: generatesobject-shape-testerShapeinstances for each model.prisma-string-dates: converts allDateorstringtypes for date fields intoUtcIsoStringfromdate-vir.prisma-branded-fields: converts allidfields into branded string types so that id types do not clash with each other and allows you to add a/// @branded()comment above any other field to also brand it. This generator also accepts an optional brand keyprefix(as a generator input in your Prisma schema).
Extensions
createPrefixedIdExtension: creates an extension that will insert prefixes before every model's id field. This requires ides to be string types.createIsoDatesPrismaExtension: this creates an extension which maps allDatetypes into ISO strings. Use in conjunction with theprisma-string-datesgenerator for proper types.
