Skip to content
Back to skills

Run Migrations

ASecurity

Quick reference for golang-migrate: creates up/down migrations, runs pending ones, rolls back the last one. For schema design, zero-downtime and multi-tenant see /data-migrations.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 14, 2026
databasesgobashsqlgitdatabase

Security analysis

A100/100

Scanned November 14, 2026

npx -y skills add SebastianLuser/claude-code-arcane --skill run-migrations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Run Migrations?

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

Security grade badge for Run Migrations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sebastianluser-run-migrations/badge)](https://www.skillsdirectory.com/skills/sebastianluser-run-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: run-migrations
description: "Quick reference for golang-migrate: creates up/down migrations, runs pending ones, rolls back the last one. For schema design, zero-downtime and multi-tenant see /data-migrations."
category: "database"
argument-hint: "[create <name> | up | down [N]]"
user-invocable: true
allowed-tools: Read, Bash
---

# Skill: run-migrations

## Trigger

When the user says "run migrations", "migrate", "create migration", "new migration", "rollback migration", or similar.

## Workflow

### Mode: create new migration

1. Ask for the migration name if not provided
2. Generate the migration files:
   ```bash
   migrate create -ext sql -dir db/migrations -seq <migration_name>
   ```
3. This creates two files:
   - `XXXXXX_<name>.up.sql` (apply changes)
   - `XXXXXX_<name>.down.sql` (rollback changes)
4. Help the user write the SQL for both files
5. Remind the user to consult `/data-migrations` if the change affects production tables (zero-downtime patterns, locks, batching, online DDL)

### Mode: run migrations

1. Check the database connection string from `.env.local` or environment
2. Run pending migrations:
   ```bash
   migrate -path db/migrations -database "$DATABASE_URL" up
   ```
3. Verify success — query `schema_migrations` table to confirm version

### Mode: rollback

1. Confirm with user before destructive rollback
2. To rollback the last migration:
   ```bash
   migrate -path db/migrations -database "$DATABASE_URL" down 1
   ```
3. To rollback N migrations: `down N`

## Prerequisites

```bash
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.17.0
```

## Notes

- Always create both up and down migrations
- Down migration should perfectly reverse the up migration
- Use `IF EXISTS` / `IF NOT EXISTS` to make migrations idempotent
- Test both up and down before committing
- For Postgres-specific (CONCURRENTLY, partitioning, JSONB indexes) consult the `sql-specialist` agent if it is installed
- For zero-downtime patterns (expand-contract, online DDL, backfills) use `/data-migrations`

## Recommended Next

- `/data-migrations` for schema design and zero-downtime strategy
- `sql-specialist` agent (if installed) for PG-specific migration patterns

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 databases →

Comments

Loading comments…

Newsletter

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