npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mrzadexinho/migratoor

v0.1.0

Published

Database migration safety checker MCP server — catch dangerous migrations before they hit production

Readme

migratoor

npm version License: MIT

Database migration safety checker MCP server. Catch dangerous migrations before they hit production.

Problem

Developers write migrations, deploy, and accidentally lock production tables for minutes. Or drop a column that running code still references. Or create an index that blocks all writes. These cause real outages.

migratoor checks your SQL migrations against 14 proven safety rules from Squawk and strong_migrations, explains why each pattern is dangerous, and suggests the safe alternative — all as MCP tools in your AI editor.

Quick Start

As MCP Server

Works with any MCP-compatible client — Claude Code, Claude Desktop, Cursor, Windsurf, VS Code (Copilot), Continue.dev, Zed, Cline, and more.

{
  "mcpServers": {
    "migratoor": {
      "command": "npx",
      "args": ["-y", "@mrzadexinho/migratoor"]
    }
  }
}

As Library

import { analyzeMigration, formatReport } from '@mrzadexinho/migratoor';

const result = analyzeMigration(`
  ALTER TABLE users ADD COLUMN email TEXT NOT NULL;
  CREATE INDEX idx_email ON users (email);
`);

console.log(formatReport(result));
// [CRITICAL] Adding NOT NULL column without default blocks reads/writes
// [CRITICAL] Creating index without CONCURRENTLY blocks all writes
// Safe alternatives provided for each finding

MCP Tools

| Tool | Description | |------|-------------| | check_migration | Analyze SQL (file path or inline) for safety issues with risk levels and safe alternatives | | list_rules | List all 14 migration safety rules with severity and description | | explain_rule | Deep dive on a specific rule — why it's dangerous, what lock it takes, safe pattern |

Rules

Critical (blocks reads/writes, causes outages)

| Rule | What it catches | |------|----------------| | add-column-not-null-without-default | Adding NOT NULL column without default rewrites entire table under ACCESS EXCLUSIVE lock | | create-index-not-concurrently | CREATE INDEX blocks all writes during index build | | change-column-type | Changing column type rewrites entire table under ACCESS EXCLUSIVE lock | | add-foreign-key-without-validation | Adding FK validates all rows, blocking writes | | set-not-null-on-existing-column | SET NOT NULL scans all rows under exclusive lock |

Warning (breaks running code, data risk)

| Rule | What it catches | |------|----------------| | drop-column | Dropping column breaks cached ORM attributes and running code | | drop-table | Data loss risk, breaks dependent views/functions | | rename-column | Running code referencing old name fails immediately | | rename-table | Same as rename column with wider blast radius | | add-unique-constraint | ACCESS EXCLUSIVE lock during index build |

Info (best practices)

| Rule | What it catches | |------|----------------| | prefer-text-over-varchar | VARCHAR(N) has no performance benefit over TEXT in PostgreSQL | | prefer-jsonb-over-json | JSON lacks equality operators and indexing, use JSONB | | multiple-ddl-statements | Multiple DDL in one migration makes rollback harder | | data-in-ddl-migration | Mixing DML with DDL risks inconsistent state on failure |

Every critical and warning finding includes the safe alternative SQL — not just "this is wrong" but "here's exactly how to fix it."

Example Output

# Migration Safety Check

**3 statement(s) analyzed, 2 issue(s) found:**
- 2 critical

**This migration is NOT safe to run in production.**

## Critical

[CRITICAL] **Adding NOT NULL column without default blocks reads/writes**
Rule: `add-column-not-null-without-default` | Line: 1
```sql
ALTER TABLE users ADD COLUMN email TEXT NOT NULL

Safe alternative: Add column as nullable, backfill, then add NOT NULL constraint

ALTER TABLE users ADD COLUMN email TEXT;
ALTER TABLE users ALTER COLUMN email SET DEFAULT <value>;
UPDATE users SET email = <value> WHERE email IS NULL;
ALTER TABLE users ALTER COLUMN email SET NOT NULL;

## Architecture

migratoor/ src/ sql/ # SQL parsing layer types # Statement, ParsedMigration parser # Split SQL, classify DDL operations rules/ # Safety rules types # Rule, Finding, Severity postgres # 14 PostgreSQL safety rules registry # Rule lookup, list, filter engine/ # Analysis engine analyzer # Apply rules, collect findings, summarize reporter # Format results (structured + markdown) mcp/ # MCP server layer tools/ # 3 MCP tools tests/ # 93 tests mirroring src/ structure


## Prerequisites

- **Node.js** >= 20.0.0
- No other dependencies required — migratoor analyzes SQL statically

## Development

```bash
git clone https://github.com/mrzadexinho/migratoor.git
cd migratoor
npm install
npm run build
npm test

License

MIT