pn-database-migrations

pn-database-migrations is a skill for Cursor from perniemann/pnCore. It costs 49 tokens per session (1,046 once invoked), scanned A, original, MIT.

A guide to changing production database structures safely with Prisma, Drizzle, TypeORM, or SQL migration files.

In plain words
What is it for?
Use it when adding or changing tables, columns, indexes, seed data, or production schema deployments.
Why use it?
It reduces the risk of downtime, failed rollbacks, accidental data loss, and unsafe changes to large or shared databases.

Skill for Cursor

Written for Cursor: shipped in a Cursor plugin.

Part of the pn-core plugin — 133 skills, 19 commands, 9 agents, 1 MCP server shipped together

Good fit Use it when adding or changing tables, columns, indexes, seed data, or production schema deployments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/perniemann/pncore/pn-database-migrations
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add perniemann/pnCore --skill pn-database-migrations
Clone the repo
git clone --depth 1 https://github.com/perniemann/pnCore

Made for: Cursor.

Or install pn-core, the plugin that ships this one along with the rest of its 133 skills, 19 commands, 9 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pn-database-migrations

README.md
[![agentmods](https://agentmods.dev/badge/skills/perniemann/pncore/pn-database-migrations/github.svg)](https://agentmods.dev/skills/perniemann/pncore/pn-database-migrations)
Your own site
<a href="https://agentmods.dev/skills/perniemann/pncore/pn-database-migrations"><img src="https://agentmods.dev/badge/skills/perniemann/pncore/pn-database-migrations/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pn-database-migrations

Your own site · 80×15
<a href="https://agentmods.dev/skills/perniemann/pncore/pn-database-migrations"><img src="https://agentmods.dev/badge/skills/perniemann/pncore/pn-database-migrations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,046 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.01046
Opus 5 $0.00024 $0.00523
Sonnet 5 $0.00010 $0.00209
Haiku 4.5 $0.00005 $0.00105

Measured 5d ago against content hash 0e12d24fca38, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

pn-database-migrations scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/pn-core-mcp/content/skills/backend/pn-database-migrations/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Database migrations

When to use

  • Adding, altering, or dropping columns/tables in a production database
  • Writing or reviewing a migration file (Prisma, Drizzle, TypeORM, raw SQL)
  • Planning zero-downtime deployments that involve schema changes
  • Seeding reference data or test fixtures
  • Reviewing index coverage or query performance regressions

Core principles

  1. Migrations are immutable once committed — never edit a migration file that has been applied to any shared environment; create a new migration instead.
  2. Always pair with a rollback — every up migration must have a safe down path; document when down is destructive (irreversible data loss).
  3. Expand/contract for zero downtime — break breaking changes into two migrations: (a) add new column/table (expand), (b) backfill + switch app code, (c) drop old column (contract). Never rename or drop in one step.
  4. Gate on review — migrations that touch > 10M rows or add a non-concurrent index require explicit review before deploying to production.
  5. Never mix data and schema — separate DDL migrations (schema) from DML migrations (data backfills) to allow independent rollback.

Workflow

Prisma

# Generate migration from schema changes
npx prisma migrate dev --name add_user_email_index

# Apply pending migrations in production (CI/CD)
npx prisma migrate deploy

# Inspect current migration status
npx prisma migrate status

# Reset dev database (destructive — dev only)
npx prisma migrate reset
  • Store migrations/ directory in version control; commit with the code change that requires it.
  • Use prisma db seed with prisma/seed.ts for reference data; keep seed idempotent (upsert, not insert).
  • For large table changes, use --create-only flag, then edit the SQL before applying.

Drizzle

# Generate migration
npx drizzle-kit generate:pg   # or :mysql, :sqlite

# Apply migrations
npx drizzle-kit push:pg       # dev: push directly
# Production: use drizzle-orm/node-postgres migrator in startup script

Read the full file on GitHub · 104 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 104 lines · 49 tokens per session scan A 0e12d24fca38

Subscribe to this mod's changes

pn-database-migrations is a skill published in the GitHub repository perniemann/pnCore (0 stars, last pushed 2d ago), licensed MIT. It adds 49 tokens to every session and 1,046 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.