Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 6892 - avoid adding clause when table not present #6943

Merged
merged 4 commits into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions backend/plugins/gitlab/tasks/trigger_job_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading