Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

golang-migrate

$ migrate Community High Risk
golang-migrate · Database & Data · MIT · macos / linux / windows

golang-migrate (migrate) applies versioned .up.sql and .down.sql migrations across PostgreSQL, MySQL, SQLite, ClickHouse, MongoDB, and Cassandra. Ships as a fast single Go binary supporting up N, down N, version, and force for dirty-state recovery.

FCRS-1.0 Score
79 /100
Good
Medium Confidence
Zero-Friction Install
brew install golang-migrate
CLI vs MCP Decision CLI Only

migrate executes ordered local .sql migration files directly against a target database DSN; MCP adds unnecessary indirection.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 17 / 25

Deterministic non-interactive CLI (up, down, version, create) with clear exit codes, though output is plain text with no --json or --dry-run.

  • Non-interactive subcommands; no --json or --dry-run support
Trust & Safety 19 / 25

Marks failed migrations as dirty to prevent cascading corruption, though unbounded migrate down prompts only on TTY and drop/force are dangerous if misused.

  • Dirty-version lock prevents partial replays; drop and unbounded down carry high risk
Setup & Portability 14 / 15

Single static Go binary available via Homebrew, Go install, and GitHub Releases across macOS, Linux, and Windows.

  • Static Go binary via brew install golang-migrate
Utility & Efficiency 13 / 15

Supports broad SQL and NoSQL drivers plus remote sources (GitHub, S3, GCS) in one small binary.

  • Multi-DB support including Postgres, MySQL, SQLite, ClickHouse, and MongoDB
Maintenance & Lineage 8 / 10

Widely used community standard (golang-migrate/migrate) under MIT license.

  • Standard Go migration repository under MIT
Docs & Verifiability 8 / 10

Clear CLI README and driver docs in the repository.

  • Documented at github.com/golang-migrate/migrate

Security, Auth & Guardrails

Auth Modes
Env API Key No Auth
Credential Storage

Reads target DSN from -database "$DATABASE_URL" (with env expansion in scripts) and migration source paths from -path or S3/GCS URLs.

Side Effects
Read-Only Local Write Remote Write Destructive
Cost & Quotas

100% free and MIT open-source.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# golang-migrate (migrate) Agent Rules
- Always run `migrate -path ... -database "$DATABASE_URL" version` before `up`.
- Prefer step-bounded `down 1` instead of unbounded `down` (unbounded `down` rolls back every migration).
- NEVER run `migrate drop` or `migrate force` without inspecting the failed DDL and getting approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

Check current applied migration version
migrate -path ./migrations -database "$DATABASE_URL" version

Prints the active migration version and fails cleanly if the database is in a dirty state.

Controlled Writes & Previews

Apply pending database migrations
migrate -path ./migrations -database "$DATABASE_URL" up

Runs all unapplied .up.sql migrations in ./migrations against $DATABASE_URL.

Strengths for Agents

  • + Fast single Go binary supporting SQL and NoSQL engines with paired .up.sql / .down.sql files.
  • + Tracks dirty state automatically so failed migrations halt safely before further changes.

Caveats & Pitfalls

  • ! Lacks --json output and --dry-run SQL preview.
  • ! Running migrate down without a step count rolls back all migrations; go install requires driver build tags.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI