Skip to content

Commit

Permalink
Add route shapees saving with a idempotent upsert
Browse files Browse the repository at this point in the history
Co-Authored-By: David Costa <david@zarel.net>
  • Loading branch information
CDimonaco and zarelit committed Nov 29, 2021
1 parent 5bae170 commit 0aa9b28
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/infrastructure/postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ func (c *Client) SetRouteShapes(
"generated",
"geometry",
"centroid",
)
).
Suffix(`
on conflict (route_id, direction_id) do update set
feed_version_id = excluded.feed_version_id,
shape_id = excluded.shape_id,
"generated" = excluded.generated,
geometry = excluded.geometry,
centroid = excluded.centroid
`)

rs := chunkRouteShapes(routeShapes, routeShapesInsertChunkSize)

Expand Down

0 comments on commit 0aa9b28

Please sign in to comment.