A CLI tool for analyzing database migrations and schema changes for scalability and evolvability risks
npm install db-scalability-guardianAnalyze database migrations for scalability and evolvability risks before they hit production.
- 🔍 16+ deterministic rules — Detects NOT NULL additions, type changes, drops, index locks, enum modifications
- 🤖 AI-powered analysis — Architectural insights and future feature blockers (paid plans)
- 🚦 CI/CD gate — Block deployments on HIGH/CRITICAL findings
- 📊 Multiple formats — JSON + Markdown reports
- 🔀 Git-aware — Only analyzes changed migrations between branches
``bash`
npm install --save-dev db-scalability-guardian
Create a free account at db-guardian.com and generate your API key.
`bash`
export DB_GUARDIAN_API_KEY=DB-GUARDIAN-XXXXX
`bash`
npx db-scalability-guardian analyze
Create guardian.config.json in your repository root (optional):
`json`
{
"database": {
"migrationsPath": "prisma/migrations"
},
"gate": {
"failOn": ["HIGH", "CRITICAL"]
},
"guardian": {
"enableAI": true
}
}
| Option | Description | Default |
|--------|-------------|---------|
| database.migrationsPath | Path to migrations folder | prisma/migrations |gate.failOn
| | Severities that cause exit code 1 | ["HIGH", "CRITICAL"] |guardian.enableAI
| | Enable AI analysis (paid plans) | true |
`yaml
name: DB Scalability Check
on:
pull_request:
branches: [main]
jobs:
guardian:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run DB Scalability Guardian
run: npx db-scalability-guardian analyze
env:
DB_GUARDIAN_API_KEY: ${{ secrets.DB_GUARDIAN_API_KEY }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: guardian-reports
path: guardian-reports/
`
Reports are generated in guardian-reports/:
| File | Description |
|------|-------------|
| guardian-report.json | Machine-readable findings |guardian-report.md
| | Human-readable report |guardian-llm-analysis.md
| | AI architectural analysis (if enabled) |
| Severity | Patterns |
|----------|----------|
| CRITICAL | DROP TABLE, DROP COLUMN, TRUNCATE |ADD COLUMN NOT NULL
| HIGH | , TYPE CHANGE, RENAME TABLE, ALTER TYPE ADD/DROP VALUE, SET NOT NULL |CREATE INDEX
| MEDIUM | , ADD FK, RENAME COLUMN, Multiple ALTER TABLE, UPDATE/DELETE |DROP INDEX
| LOW | |
- 0 — Success, no blocking findings1` — Blocking findings detected
-
| Plan | Deterministic | AI Analysis | Price |
|------|--------------|-------------|-------|
| Free | ✅ Unlimited | ❌ | $0 |
| Starter | ✅ Unlimited | 50/month | $9/mo |
| Professional | ✅ Unlimited | 200/month | $29/mo |
Overage: $0.015 per additional AI analysis.
ISC