Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Commit

Permalink
Merge pull request #199 from guzart/date-versions
Browse files Browse the repository at this point in the history
Date-based versions
  • Loading branch information
mattes authored Apr 16, 2017
2 parents b83285b + d789d50 commit c0703e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Regex = regexp.MustCompile(`^([0-9]+)_(.*)\.(` + string(Down) + `|` + string
func Parse(raw string) (*Migration, error) {
m := Regex.FindStringSubmatch(raw)
if len(m) == 5 {
versionUint64, err := strconv.ParseUint(m[1], 10, 32)
versionUint64, err := strconv.ParseUint(m[1], 10, 64)
if err != nil {
return nil, err
}
Expand Down
10 changes: 10 additions & 0 deletions source/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ func TestParse(t *testing.T) {
Raw: "1485385885_foobar.up.sql",
},
},
{
name: "20170412214116_date_foobar.up.sql",
expectErr: nil,
expectMigration: &Migration{
Version: 20170412214116,
Identifier: "date_foobar",
Direction: Up,
Raw: "20170412214116_date_foobar.up.sql",
},
},
{
name: "-1_foobar.up.sql",
expectErr: ErrParse,
Expand Down

0 comments on commit c0703e7

Please sign in to comment.