File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 88 "io"
99 "io/fs"
1010 "sort"
11+ "strconv"
1112 "strings"
1213 "time"
1314
@@ -291,12 +292,22 @@ func WithNopMigration() MigrationOption {
291292
292293func sortAsc (ms MigrationSlice ) {
293294 sort .Slice (ms , func (i , j int ) bool {
295+ ni , ei := strconv .ParseInt (ms [i ].Name , 10 , 64 )
296+ nj , ej := strconv .ParseInt (ms [j ].Name , 10 , 64 )
297+ if ei == nil && ej == nil && ni != nj {
298+ return ni < nj
299+ }
294300 return ms [i ].Name < ms [j ].Name
295301 })
296302}
297303
298304func sortDesc (ms MigrationSlice ) {
299305 sort .Slice (ms , func (i , j int ) bool {
306+ ni , ei := strconv .ParseInt (ms [i ].Name , 10 , 64 )
307+ nj , ej := strconv .ParseInt (ms [j ].Name , 10 , 64 )
308+ if ei == nil && ej == nil && ni != nj {
309+ return ni > nj
310+ }
300311 return ms [i ].Name > ms [j ].Name
301312 })
302313}
You can’t perform that action at this time.
0 commit comments