This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v1.0 by this push:
new 2c499753c fix(migration): panic when `ExecuteMigration` fails (#8070)
(#8076)
2c499753c is described below
commit 2c499753cf7ae154cd8d2452e4cfe3bda6ceb0c6
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Sep 20 10:02:03 2024 +0800
fix(migration): panic when `ExecuteMigration` fails (#8070) (#8076)
Co-authored-by: Lynwee <[email protected]>
---
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())