Compare commits

...

2 Commits

Author SHA1 Message Date
0a6995eaca Fix bug with migration template name 2019-11-10 01:35:06 -05:00
06ed823a51 Fix bug with creating new migrations 2019-11-10 01:33:06 -05:00
3 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import (
"github.com/pkg/errors"
)
var migrationPattern = regexp.MustCompile(`\A(\d+)_.+\.sql\z`)
var migrationPattern = regexp.MustCompile(`\A(\d+)_[^\.]+\.sql\z`)
var ErrNoFwMigration = errors.Errorf("no sql in forward migration step")
@ -127,7 +127,7 @@ func FindMigrationsEx(path string, fs MigratorFS) ([]string, error) {
return nil, err
}
mcount := len(paths) + 100
mcount := len(paths)
if n < int64(mcount) {
return nil, fmt.Errorf("Duplicate migration %d", n)

View File

@ -124,7 +124,7 @@ func cmdDBNew(cmd *cobra.Command, args []string) {
os.Exit(1)
}
mname := fmt.Sprintf("%03d_%s.sql", len(m)+100, name)
mname := fmt.Sprintf("%03d_%s.sql", (len(m) + 1), name)
// Write new migration
mpath := filepath.Join(conf.MigrationsPath, mname)