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

klesh pushed a commit to branch kw-migration-logging
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit aedc50429cdfcd732b7232dc3f419d058cd510b1
Author: Klesh Wong <[email protected]>
AuthorDate: Mon Mar 18 15:58:22 2024 +0800

    refactor: db migration logging logic
---
 backend/server/services/init.go | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/backend/server/services/init.go b/backend/server/services/init.go
index b40d99ff2..23ee73239 100644
--- a/backend/server/services/init.go
+++ b/backend/server/services/init.go
@@ -98,14 +98,17 @@ func Init() {
        }
 
        // check if there are pending migration
-       forceMigration := cfg.GetBool("FORCE_MIGRATION")
-       if !migrator.HasPendingScripts() || forceMigration {
-               err = ExecuteMigration()
-               if err != nil {
-                       panic(err)
+       if migrator.HasPendingScripts() {
+               if cfg.GetBool("FORCE_MIGRATION") {
+                       err = ExecuteMigration()
+                       if err != nil {
+                               panic(err)
+                       }
+                       logger.Info("db migration without confirmation")
+               } else {
+                       logger.Info("db migration confirmation needed")
                }
        }
-       logger.Info("Db migration confirmation needed")
 }
 
 // ExecuteMigration executes all pending migration scripts and initialize 
services module

Reply via email to