Static analysis tool for Prisma SQL migrations that detects dangerous database operations before deployment. Version 0.3.2 analyzes migration SQL files, parses them into an AST, and applies rules to catch destructive column drops, type changes with write locks, missing indexes on foreign keys, non-concurrent index creation, and other common footguns. Unlike manual review or general SQL linters, PrismaGuard is purpose-built for Prisma's migration format and encodes database reliability patterns. Ships TypeScript types and requires Node.js 20+. Release cadence is monthly.
npm install prismaguardsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Analyzes all migrations in a directory and outputs JSON report with risk level and exit on high risk.
Update imports to use ESM syntax or switch to import().
Pass options as object: analyze(dir, { failOn: 'HIGH' }) instead of analyze(dir, 'HIGH').Replace --fail-on-high-risk with --fail-on HIGH.
Use resolve() or path.join() to create absolute path before passing to analyze.
Add --silent when using --json to suppress formatted output.
npm install --save-dev prismaguards and use import instead of require.
Use path.resolve() to convert relative path to absolute before calling analyze.
Ensure the migration directory contains only .sql files generated by Prisma.