Skip to content

Commit 3115a87

Browse files
committed
allow colons in the file storage versions
1 parent 76958d2 commit 3115a87

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

storage/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ have versions. A version is a string is alphanumerically sortable. In the
1313
case the file storage each migration file name should match the format
1414
described by this regex:
1515

16-
```^([\d\-_]+)[\-_]([\w\-]+)[\-_](apply|rollback)(\.\w+)?$```
16+
```^([\d\-_]+:)[\-_]([\w\-]+)[\-_](apply|rollback)(\.\w+)?$```
1717

1818
The file name consists of
1919

20-
- the version (numbers, "_", and "-" characters)
20+
- the version (numbers, "_", ":", and "-" characters)
2121
- a "-" or "_" character
2222
- a name for the migration (numbers, alpha, "_", and "-" characters)
2323
- a "-" or "_" character
@@ -34,8 +34,8 @@ Examples of possible file names:
3434

3535
```
3636
/path/to/migrations/directory
37-
2020-10-01-153535-migration-name-apply
38-
2020-10-01-153535-migration-name-rollback
37+
2020-10-01-15:35:35-migration-name-apply
38+
2020-10-01-15:35:35-migration-name-rollback
3939
```
4040

4141
Because the versions are strings and sorted alpha-numerically "1" and "10" come

storage/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
var (
14-
migratationFileNameRe = regexp.MustCompile(`^([\d\-_]+)[\-_]([\w\-]+)[\-_](apply|rollback)(\.\w+)?$`)
14+
migratationFileNameRe = regexp.MustCompile(`^([\d\-_:]+)[\-_]([\w\-]+)[\-_](apply|rollback)(\.\w+)?$`)
1515
)
1616

1717
// FileStorage ...

0 commit comments

Comments
 (0)