CODESEEDSign in
Explore projects
Gointermediatecli

SQL Migration Runner

CLI tool for running versioned SQL migrations: up/down, dry-run, migration lock for concurrency, and automatic rollback on error.

5 steps

Project steps

  1. 01

    Migration files

    Convention: 001_create_users.up.sql and 001_create_users.down.sql.

  2. 02

    Schema version table

    migrations(version, applied_at, checksum) table in the database.

  3. 03

    Distributed lock

    PostgreSQL advisory lock or MySQL row lock to prevent parallel runs.

  4. 04

    Dry-run

    Flag --dry-run: shows what SQL would run without executing.

  5. 05

    Rollback on error

    If a migration fails, automatically runs .down.sql and exits with a clear error.

Recommended resources

Ready to build this?

Fork the repo on GitHub and start building. A mentor will review your code when you open a PR.

5 steps

Tech stack

Gocobrapgxmysql driverembed