fix(sql-migrate): reject explicit 'up 0' and 'down 0' as invalid

An explicit 0 argument should error, not silently run all pending (up)
or get handled as a special case (down). Change the guard from < 0 to
< 1 in both subcommands so '0' is treated as invalid input.
This commit is contained in:
AJ ONeal 2026-04-08 14:54:28 -06:00
parent 03d81a2b76
commit 2080ae223d
No known key found for this signature in database

View File

@ -364,10 +364,10 @@ func main() {
var downN int
switch len(leafArgs) {
case 0:
// ignore
// default: roll back one
case 1:
downN, err = strconv.Atoi(leafArgs[0])
if err != nil || downN < 0 {
if err != nil || downN < 1 {
fmt.Fprintf(os.Stderr, "Error: %s is not a positive number\n", leafArgs[0])
os.Exit(1)
}