You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/03/18 07:58:50 UTC

(incubator-devlake) branch kw-migration-logging created (now aedc50429)

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

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


      at aedc50429 refactor: db migration logging logic

This branch includes the following new commits:

     new aedc50429 refactor: db migration logging logic

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: refactor: db migration logging logic

Posted by kl...@apache.org.
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 <zh...@merico.dev>
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