wasp/waspc/packages/prisma/README.md
Martin Šošić 4d4c2c2f72
Wasp AI: got prisma format working, fixed recovery on http errors
* Put some skeleton logic in.

* Fixed wrong handling of http errors, got prisma format working.

* fix
2023-07-07 01:24:26 +02:00

772 B

This package contains useful tools for working with Prisma, especially PSL.

Setup

Run npm install.

Usage

Run npm run build to compile TS to JS. Do this after any changes to TS files, or if you have never run it before.

format

Run npm start format and pass prisma schema source (so PSL) via stdin. It can even be an incomplete schema -> e.g. just model declarations.

This will run prisma format on it and return formatted schema (PSL) + any warnings/errors. Note: prisma format does not just format stuff, but even fix some simple mistakes like incomplete relations!

Response, on stdout, will be JSON of the following shape:

{
  "formattedSchemaPsl": "<psl>",
  "errors": "<all errors as one big string>"  // undefined if no errors.
}