Skip to content

Commit

Permalink
Remove up to one excess occurrence of .sql at end of script suffix ar…
Browse files Browse the repository at this point in the history
…gument, since we already append it automatically
  • Loading branch information
MMulthaupt committed Feb 9, 2021
1 parent 388744c commit 374f1c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"strings"
)

const FlagMajor = "major"
Expand Down Expand Up @@ -45,6 +46,9 @@ func Parse(args []string) *Flags {
}
if fs.NArg() == 1 {
f.ScriptPrefix = fs.Arg(0)
if strings.HasSuffix(f.ScriptPrefix, ".sql") {
f.ScriptPrefix = f.ScriptPrefix[:len(f.ScriptPrefix)-4]
}
} else {
f.ScriptPrefix = "migration"
}
Expand Down

0 comments on commit 374f1c9

Please sign in to comment.