Skip to content
Back to skills

Migrations

ASecurity

Rules for naming and chaining database migration files. Use when creating or reviewing a migration file, or when a migration merge conflict or multi-head state comes up.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agentsbashnodeapidatabase

Works with

  • api

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add xrhstosmour/macsify --skill migrations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Migrations?

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

Security grade badge for Migrations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xrhstosmour-migrations/badge)](https://www.skillsdirectory.com/skills/xrhstosmour-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: migrations
description: Rules for naming and chaining database migration files. Use when creating or reviewing a migration file, or when a migration merge conflict or multi-head state comes up.
---

# Migrations

## When to use

- Creating a new database migration file.
- Reviewing a migration file's timestamp or `down_revision`/parent link.
- A migration chain has diverged into multiple heads, or CI is failing an `upgrade head` check.

## Timestamps

Always use real, generated timestamps with millisecond precision when naming migration files. Never hardcode sequential or placeholder timestamps.

```bash
# Generate a real timestamp with milliseconds (UTC).
date -u +"%Y%m%d%H%M%S%3N"
```

Do not use timestamps that look hand-typed or sequential, like `20260706120000`, `20260706120001`, `20260707120000`. These lack sub-second precision and can collide when migrations are generated in rapid succession. Better use the framework's built-in migration generator if it exists, or generate a timestamp programmatically.

## Chain

Migration chains must stay linear with a single head. Concurrent PRs adding migrations from different ancestors create a multi-head state that blocks `upgrade head` and fails CI.

- **CI check**: Verify a single head in the lint step, no database connection required.
- **Generate from head**: Always run `upgrade head` first so new migrations chain off the current tip.
- **Merge heads immediately**: Resolve divergence via the framework's merge command in a dedicated PR before any new migration is added.
- **Down-revision from script**: Set `down_revision` to the output of `current`, after `upgrade head`, never an intermediate node.

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.

Comments

Loading comments…

Newsletter

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