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/10/31 08:20:38 UTC

(incubator-devlake) branch release-v1.0 updated: fix: make sql query PostgreSQL compatible (#8167)

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

klesh 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 b12271fb8 fix: make sql query PostgreSQL compatible (#8167)
b12271fb8 is described below

commit b12271fb8581c09788466acd34d172d1d9961a7b
Author: Alex Tonkonozhenko <to...@gmail.com>
AuthorDate: Thu Oct 31 09:20:34 2024 +0100

    fix: make sql query PostgreSQL compatible (#8167)
---
 backend/plugins/dora/tasks/incident_from_issue_generator.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/backend/plugins/dora/tasks/incident_from_issue_generator.go b/backend/plugins/dora/tasks/incident_from_issue_generator.go
index bb3610898..d70cd2ce5 100644
--- a/backend/plugins/dora/tasks/incident_from_issue_generator.go
+++ b/backend/plugins/dora/tasks/incident_from_issue_generator.go
@@ -57,11 +57,11 @@ func ConvertIssuesToIncidents(taskCtx plugin.SubTaskContext) errors.Error {
 			 FROM issues i
 			 LEFT JOIN board_issues bi ON bi.issue_id = i.id
 			 LEFT JOIN project_mapping pm ON pm.row_id = bi.board_id
-			 WHERE i.type = "INCIDENT"
+			 WHERE i.type = ?
 			   AND pm.project_name = ?
-		       AND pm.table = "boards")
+		       AND pm.table = ?)
 	`
-	if err := db.Exec(deleteIncidentsSql, data.Options.ProjectName); err != nil {
+	if err := db.Exec(deleteIncidentsSql, "INCIDENT", data.Options.ProjectName, "boards"); err != nil {
 		return errors.Default.Wrap(err, "error deleting previous incidents")
 
 	}
@@ -73,11 +73,11 @@ func ConvertIssuesToIncidents(taskCtx plugin.SubTaskContext) errors.Error {
 			 FROM issues i
 			 LEFT JOIN board_issues bi ON bi.issue_id = i.id
 			 LEFT JOIN project_mapping pm ON pm.row_id = bi.board_id
-			 WHERE i.type = "INCIDENT"
+			 WHERE i.type = ?
 			   AND pm.project_name = ?
-		       AND pm.table = "boards")
+		       AND pm.table = ?)
 	`
-	if err := db.Exec(deleteIncidentAssigneesSql, data.Options.ProjectName); err != nil {
+	if err := db.Exec(deleteIncidentAssigneesSql, "INCIDENT", data.Options.ProjectName, "boards"); err != nil {
 		return errors.Default.Wrap(err, "error deleting previous incident_assignees")
 	}