package migration import ( "context" _ "embed" "fmt" "github.com/jackc/pgx/v5/pgxpool" ) //go:embed sql/001_initial.sql var m001 string //go:embed sql/002_add_external_id.sql var m002 string func Run(ctx context.Context, pool *pgxpool.Pool) error { for i, sql := range []struct { version int sql string }{ {1, m001}, {2, m002}, } { if _, err := pool.Exec(ctx, sql.sql); err != nil { return fmt.Errorf("migration %03d: %w", i+1, err) } } return nil }