This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 6f0e0dbb4 fix(migration): panic when `ExecuteMigration` fails (#8070)
6f0e0dbb4 is described below

commit 6f0e0dbb48e6abb585bbd4e693e20db7fd595576
Author: Lynwee <[email protected]>
AuthorDate: Fri Sep 20 09:58:43 2024 +0800

    fix(migration): panic when `ExecuteMigration` fails (#8070)
---
 backend/server/api/api.go       | 7 +------
 backend/server/services/init.go | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/backend/server/api/api.go b/backend/server/api/api.go
index 69ca8a374..a2b590be4 100644
--- a/backend/server/api/api.go
+++ b/backend/server/api/api.go
@@ -122,12 +122,7 @@ func SetupApiServer(router *gin.Engine) {
        // Endpoint to proceed database migration
        router.GET("/proceed-db-migration", func(ctx *gin.Context) {
                // Execute database migration
-               err := services.ExecuteMigration()
-               if err != nil {
-                       // Return error response
-                       shared.ApiOutputError(ctx, errors.Default.Wrap(err, 
"error executing migration"))
-                       return
-               }
+               errors.Must(services.ExecuteMigration())
                // Return success response
                shared.ApiOutputSuccess(ctx, nil, http.StatusOK)
        })
diff --git a/backend/server/services/init.go b/backend/server/services/init.go
index 7e794e68a..a4eb334c2 100644
--- a/backend/server/services/init.go
+++ b/backend/server/services/init.go
@@ -96,7 +96,7 @@ func registerPluginsMigrationScripts() {
 
 func InitExecuteMigration() {
        // check if there are pending migration
-       logger.Info("has pending scripts? %v, FORCE_MIGRATION: %s", 
migrator.HasPendingScripts(), cfg.GetBool("FORCE_MIGRATION"))
+       logger.Info("has pending scripts? %v, FORCE_MIGRATION: %v", 
migrator.HasPendingScripts(), cfg.GetBool("FORCE_MIGRATION"))
        if migrator.HasPendingScripts() {
                if cfg.GetBool("FORCE_MIGRATION") {
                        errors.Must(ExecuteMigration())

Reply via email to