Skip to content

Commit ee5f20b

Browse files
committed
feat: sort migration config
1 parent 04b4047 commit ee5f20b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/config/migration.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/blang/semver"
55
"github.com/pkg/errors"
66
"github.com/zeromake/docker-debug/version"
7+
"sort"
78
"strings"
89
)
910

@@ -39,6 +40,9 @@ func MigrationConfig(conf *Config) error {
3940
conf.MountDir = conf.MountDir[:l-1]
4041
}
4142
if v2.LT(v1) {
43+
sort.Slice(migrationArr, func(i, j int) bool {
44+
return migrationArr[i].Version.LT(migrationArr[j].Version)
45+
})
4246
for _, m := range migrationArr {
4347
if v2.LT(m.Version) {
4448
err = m.Up(conf)

0 commit comments

Comments
 (0)