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 1 commit
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
6 changes: 5 additions & 1 deletion backend/plugins/gitlab/tasks/trigger_job_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ func GetAllPipelinesIterator(taskCtx plugin.SubTaskContext, collectorWithState *
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("and gp.gitlab_id not in (select json_extract(tj.input, '$.GitlabId') as gitlab_id from _raw_gitlab_api_trigger_job tj)"))
d4x1 marked this conversation as resolved.
Show resolved Hide resolved
}
if collectorWithState.IsIncremental && collectorWithState.Since != nil {
clauses = append(clauses, dal.Where("gitlab_updated_at > ?", collectorWithState.Since))
}
Expand Down
Loading