Skip to content
Back to skills

Db Migrations

ASecurity

Writes and applies Postgres schema migrations for Saltmarsh Booking. Use when asked to "add a column", "write a migration", "add an index", or "drop a column".

  • 198 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 12, 2026
ai-agentsgosqlnodeapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 12, 2026

npx -y skills add mblode/agent-skills --skill db-migrations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Db Migrations?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Db Migrations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mblode-db-migrations/badge)](https://www.skillsdirectory.com/skills/mblode-db-migrations)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: db-migrations
description: Writes and applies Postgres schema migrations for Saltmarsh Booking. Use when asked to "add a column", "write a migration", "add an index", or "drop a column".
---

# Database Migrations

Schema changes go through numbered SQL migrations in `packages/api/migrations`.

1. Create the next file with `pnpm --filter @saltmarsh/api exec node scripts/new-migration.mjs <name>`.
2. Write the forward migration only. We do not write down migrations.
3. Never edit a migration that has been merged. Add a new one.
4. Adding a column to `bookings` or `pitches` must be nullable or have a default, because those tables are too big to rewrite during a deploy.
5. Add an index with `CREATE INDEX CONCURRENTLY` in its own migration file, with `-- no-transaction` on the first line.
6. Dropping a column takes two releases: stop reading and writing it in release one, drop it in release two.
7. Run `pnpm db:migrate` locally, then `pnpm db:generate` to refresh the typed client.
8. Commit the migration and the regenerated `packages/api/src/db/types.ts` together.

## Gotchas

- Migrations run before the new API version starts, so each one must work with the previous version of the code.
- A `NOT NULL` constraint on an existing column is added as `NOT VALID`, then validated in a second migration.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.