# Db Migrations

Create a database migration with Drizzle on a fresh Neon branch, and check it is safe...

- Repository: https://github.com/ParadevAI/Paradev (15823 stars)
- Category: Data and ML
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add ParadevAI/Paradev --skill db-migrations -g -a claude-code -y`
Codex: `npx skills add ParadevAI/Paradev --skill db-migrations -g -a codex -y`
Cursor: `npx skills add ParadevAI/Paradev --skill db-migrations -g -a cursor -y`
Gemini CLI: `npx skills add ParadevAI/Paradev --skill db-migrations -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add ParadevAI/Paradev`

## Description

Create a database migration with Drizzle on a fresh Neon branch, and check it is safe to run against production under load. Use when changing the packages/db schema, generating migrations, or reviewing one.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# DB migrations

A migration that is correct on a quiet database can still take production down. On 17 September
2026 migration 0119 rewrote `ingest.webhook_events` (about 540 GB with indexes) while holding
ACCESS EXCLUSIVE on the auth tables, and took the API down. Generate the migration with the steps
below, then clear the safety checklist before opening the PR.

## Generate

1. Spin up a new Neon branch and point the root `.env` files at it. `NEON_ORG_ID` and
   `NEON_PROJECT_ID` are in `.env`; the Neon `list_projects` tool needs `org_id` passed in.
2. Change the schema in `packages/db/src/schema/`.
3. Run `bunx drizzle-kit generate --name="<sample_name_snake_case>"` from `packages/db`.
4. Apply it to your dev branch only. Never apply against a shared or production database; those go
   through the deploy flow described under "What the production deploy does".

**Never hand-edit `packages/db/drizzle/`** (`.sql` files, `meta/_journal.json`, snapshots) without
explicit user confirmation. Change the schema and let `drizzle-kit generate` write the files. The
one legitimate reason to ask for that confirmation is statement order (rule 3).

## Safety checklist

The rest: https://github.com/ParadevAI/Paradev/blob/HEAD/.agents/skills/db-migrations/SKILL.md
