AJ ONeal e11b228765
fix(pgmigrate): handle 42P01 surfaced lazily at rows.Err()
pgx/v5's Conn.Query is lazy — when the queried table doesn't exist,
the 42P01 error doesn't surface at Query() time, it surfaces at
rows.Err() after the iteration loop. The original code only checked
for 42P01 at the Query() site, so first-run migrations against an
empty database failed with:

    reading rows: ERROR: relation "_migrations" does not exist (SQLSTATE 42P01)

Apply the typed-error check at both sites via a shared helper.
2026-04-10 00:01:55 -06:00
..

sqlmigrate

Database-agnostic SQL migration library for Go.

Go Reference

Backend packages

Each backend is a separate Go module to avoid pulling unnecessary drivers:

Package Database Driver
pgmigrate PostgreSQL pgx/v5
mymigrate MySQL / MariaDB go-sql-driver/mysql
litemigrate SQLite database/sql (caller imports driver)
msmigrate SQL Server go-mssqldb
shmigrate Shell scripts (uses native CLI)

CLI

The sql-migrate CLI uses shmigrate to generate shell scripts for managing migrations without a Go dependency at runtime.