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

More conditions based on source column for consul sql updates #275

Merged
merged 1 commit into from
Dec 11, 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
10 changes: 6 additions & 4 deletions crates/corrosion/src/command/consul/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ fn append_upsert_service_statements(
meta = excluded.meta,
port = excluded.port,
address = excluded.address,
updated_at = excluded.updated_at;"
updated_at = excluded.updated_at
WHERE source IS NULL;"
.into(),
vec![
node.into(),
Expand Down Expand Up @@ -457,7 +458,8 @@ fn append_upsert_check_statements(
name = excluded.name,
status = excluded.status,
output = excluded.output,
updated_at = excluded.updated_at;"
updated_at = excluded.updated_at
WHERE source IS NULL;"
.into(),vec![
node.into(),
check.id.into(),
Expand Down Expand Up @@ -651,7 +653,7 @@ async fn execute(
vec![id.clone().into()],
));
statements.push(Statement::WithParams(
"DELETE FROM consul_services WHERE node = ? AND id = ?;".into(),
"DELETE FROM consul_services WHERE node = ? AND id = ? AND source IS NULL;".into(),
vec![node.into(), id.into()],
));
}
Expand All @@ -677,7 +679,7 @@ async fn execute(
vec![id.clone().into()],
));
statements.push(Statement::WithParams(
"DELETE FROM consul_checks WHERE node = ? AND id = ?;".into(),
"DELETE FROM consul_checks WHERE node = ? AND id = ? AND source IS NULL;".into(),
vec![node.into(), id.into()],
));
}
Expand Down
Loading