Registry / devops / prisma-safety

prisma-safety

JSON →
library0.0.8jsnpmunverified

A safe schema change checker for Prisma that catches unsafe database migrations by diffing current and draft schema versions. Current version is 0.0.8, released sporadically. It prevents accidental deletion of models or fields without prior `@@ignore` or `@ignore` annotations. Unlike prisma-lint (single-schema analysis), prisma-safety requires both old and new schemas to compute diffs. Integrates as a CLI tool or GitHub Action step.

npm install prisma-safety
INSTALL
IMPORT
SIG · PRISMA-SAFETY
P
prisma-safety
devopsjavascriptv0.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CLI
npx prisma-safety <base-sha>
npx prisma-safety --help
CLI tool, not a library import. The package has no programmatic API, only CLI usage.
GitHub Action
run: yarn prisma-safety ${{ github.event.pull_request.base.sha }}
run: npx prisma-safety origin/main
In GitHub Actions, use the base SHA to ensure correct diff base.

Fetches main branch, checks if schema changed, then runs prisma-safety diff against main.

git fetch origin main git diff --name-only main...HEAD | grep -q 'prisma/schema.prisma' || exit 0 npx prisma-safety origin/main
Debug
Known issues
breakingRequires git history to compute base SHA; not compatible with detached HEAD.
fix
Ensure the base SHA is available (e.g., git fetch origin <branch>).
affects: >=0.0.1
deprecatedThe CLI option `-s` may be renamed in future versions.
fix
Use `--schema` explicitly.
affects: >=0.0.1 <0.1.0
gotchaOnly checks for deletions of models/fields; does NOT check column type changes or renames.
fix
Manually review type changes or use prisma-lint for additional checks.
affects: >=0.0.1
Errors
Common errors & fixes
Unsafe change to "Model.field": Expected deleted field to have been marked with @ignore prior to delete.
Field removed in new schema without `@ignore` annotation in the previous schema.
fix
Add `@ignore` to the field in the current schema, then remove it in a subsequent migration.
Error: Schema file not found at path prisma/schema.prisma
No schema file at default location or custom path not provided.
fix
Specify schema location with `--schema` option.
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
@prisma/internalsrequiredUsed internally to parse Prisma schema files
Agent activity
11 hits · last 30 days
node
10
Resources
prisma-safety — npm install prisma-safety · libregistry