You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/05/08 03:01:02 UTC

(incubator-devlake) branch main updated: fix: file_path column too long (#7437)

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

lynwee 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 6f3fe00a1 fix: file_path column too long (#7437)
6f3fe00a1 is described below

commit 6f3fe00a11eabc0ab5a997a4e065d76e153b019c
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed May 8 11:00:58 2024 +0800

    fix: file_path column too long (#7437)
    
    * fix: file_path column too long
    
    * fix: optimize the display of Engineering Overview Dashboard
---
 .../20240508_modify_commit_character_type.go       | 54 ++++++++++++++++++++++
 .../sonarqube/models/migrationscripts/register.go  |  1 +
 grafana/dashboards/EngineeringOverview.json        |  2 +-
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/backend/plugins/sonarqube/models/migrationscripts/20240508_modify_commit_character_type.go b/backend/plugins/sonarqube/models/migrationscripts/20240508_modify_commit_character_type.go
new file mode 100644
index 000000000..5ba5d668d
--- /dev/null
+++ b/backend/plugins/sonarqube/models/migrationscripts/20240508_modify_commit_character_type.go
@@ -0,0 +1,54 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"net/url"
+
+	"github.com/apache/incubator-devlake/core/context"
+	"github.com/apache/incubator-devlake/core/errors"
+)
+
+type modifyCommitCharacterType0508 struct{}
+
+func (*modifyCommitCharacterType0508) Up(basicRes context.BasicRes) errors.Error {
+	dbUrl := basicRes.GetConfig("DB_URL")
+	if dbUrl == "" {
+		return errors.BadInput.New("DB_URL is required")
+	}
+	u, err1 := url.Parse(dbUrl)
+	if err1 != nil {
+		return errors.Convert(err1)
+	}
+	if u.Scheme == "mysql" {
+		err := basicRes.GetDal().Exec(`ALTER TABLE commit_files MODIFY COLUMN file_path VARBINARY(1024);`)
+		if err != nil {
+			return err
+		}
+	}
+	return nil
+
+}
+
+func (*modifyCommitCharacterType0508) Version() uint64 {
+	return 20240508160001
+}
+
+func (*modifyCommitCharacterType0508) Name() string {
+	return "modify commit character type to VARBINARY(1024)"
+}
diff --git a/backend/plugins/sonarqube/models/migrationscripts/register.go b/backend/plugins/sonarqube/models/migrationscripts/register.go
index f7163cdae..8640203d5 100644
--- a/backend/plugins/sonarqube/models/migrationscripts/register.go
+++ b/backend/plugins/sonarqube/models/migrationscripts/register.go
@@ -31,5 +31,6 @@ func All() []plugin.MigrationScript {
 		new(modifyComponentLength),
 		new(addSonarQubeScopeConfig20231214),
 		new(modifyCommitCharacterType),
+		new(modifyCommitCharacterType0508),
 	}
 }
diff --git a/grafana/dashboards/EngineeringOverview.json b/grafana/dashboards/EngineeringOverview.json
index 5755f05d9..9e99d6c70 100644
--- a/grafana/dashboards/EngineeringOverview.json
+++ b/grafana/dashboards/EngineeringOverview.json
@@ -2244,7 +2244,7 @@
         "definition": "select\n  distinct(concat(date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m') , ':', date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m-%d'))) as month\nfrom\n  issues i\norder by month desc",
         "hide": 0,
         "includeAll": false,
-        "label": "Month",
+        "label": "Selected Month",
         "multi": false,
         "name": "month",
         "options": [],