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

lynwee pushed a commit to branch cp10
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/cp10 by this push:
     new aa3911ef1 fix(gitlab): avoid adding clause when table not present
aa3911ef1 is described below

commit aa3911ef1ea3101b00e5bc89a2a74511a72a7b48
Author: d4x1 <[email protected]>
AuthorDate: Fri Aug 9 09:38:54 2024 +0800

    fix(gitlab): avoid adding clause when table not present
---
 backend/plugins/gitlab/tasks/trigger_job_collector.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/backend/plugins/gitlab/tasks/trigger_job_collector.go 
b/backend/plugins/gitlab/tasks/trigger_job_collector.go
index 37ceba215..e1b4652b9 100644
--- a/backend/plugins/gitlab/tasks/trigger_job_collector.go
+++ b/backend/plugins/gitlab/tasks/trigger_job_collector.go
@@ -81,14 +81,18 @@ func GetAllPipelinesIterator(taskCtx plugin.SubTaskContext, 
apiCollector *helper
                dal.Select("gp.gitlab_id, gp.gitlab_id as iid"),
                dal.From("_tool_gitlab_pipelines gp"),
                dal.Where(
-                       `gp.project_id = ? and gp.connection_id = ? and 
gp.gitlab_id not in (select json_extract(tj.input, '$.GitlabId') as gitlab_id 
from _raw_gitlab_api_trigger_job tj)`,
+                       `gp.project_id = ? and gp.connection_id = ? `,
                        data.Options.ProjectId, data.Options.ConnectionId,
                ),
        }
+
+       if db.HasTable("_raw_gitlab_api_trigger_job") {
+               clauses = append(clauses, dal.Where("gp.gitlab_id not in 
(select json_extract(tj.input, '$.GitlabId') as gitlab_id from 
_raw_gitlab_api_trigger_job tj)"))
+       }
        if apiCollector.IsIncremental() && apiCollector.GetSince() != nil {
                clauses = append(clauses, dal.Where("gitlab_updated_at > ?", 
apiCollector.GetSince()))
        }
-       // construct the input iterator
+
        cursor, err := db.Cursor(clauses...)
        if err != nil {
                return nil, err

Reply via email to