]> source.dussan.org Git - gitea.git/commitdiff
Add information for migrate failure (#16803)
authorLunny Xiao <xiaolunwen@gmail.com>
Tue, 24 Aug 2021 17:46:55 +0000 (01:46 +0800)
committerGitHub <noreply@github.com>
Tue, 24 Aug 2021 17:46:55 +0000 (18:46 +0100)
Improve the reporting of errors when there is a migration failure

models/migrations/migrations.go

index 6c35d34c9707a3bbd212e706ba04d083a9a92f0a..89a60445bb26553e407d189ab3ee247194c61f03 100644 (file)
@@ -429,7 +429,7 @@ Please try upgrading to a lower version first (suggested v1.6.4), then upgrade t
                // Reset the mapper between each migration - migrations are not supposed to depend on each other
                x.SetMapper(names.GonicMapper{})
                if err = m.Migrate(x); err != nil {
-                       return fmt.Errorf("do migrate: %v", err)
+                       return fmt.Errorf("migration[%d]: %s failed: %v", v+int64(i), m.Description(), err)
                }
                currentVersion.Version = v + int64(i) + 1
                if _, err = x.ID(1).Update(currentVersion); err != nil {