- Group Reviewers
- Maniphest Tasks
- T534: Add completion information to softwareheritage.origin_visit table
T538: Add origin_visit API entry points to permit creation/update
A few comments inline
I think this function could be done directly in language SQL : remove the declaration, and do return query with [...] returning visit;
It'd be clearer if the tests were split between the add and update functions.
For consistency with how other object additions are handled, I think we should add a visit column to the occurrence_history temporary table, and use that to populate the "visit" object, rather than pass a new argument to occurrence_add.
Case in point, one of the two new arguments is not being used currently (the origin_id is pulled from the temporary table).
We can revisit this later when we'll have nailed down the so-called snapshot objects, but for now I think consistency trumps any future goals.
The origin_id is not used here (it's already a column in tmp_occurrence_history).
We're not pulling any data from origin_visit anymore so you can ditch this join.