We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04da1b6 commit 22f9eb4Copy full SHA for 22f9eb4
1 file changed
migrate/migration.go
@@ -8,6 +8,7 @@ import (
8
"io"
9
"io/fs"
10
"sort"
11
+ "strconv"
12
"strings"
13
"time"
14
@@ -291,12 +292,22 @@ func WithNopMigration() MigrationOption {
291
292
293
func sortAsc(ms MigrationSlice) {
294
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
+ }
300
return ms[i].Name < ms[j].Name
301
})
302
}
303
304
func sortDesc(ms MigrationSlice) {
305
306
307
308
309
+ return ni > nj
310
311
return ms[i].Name > ms[j].Name
312
313
0 commit comments