Upgrade gorm dependency in Turing API #261
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrading to Gorm v2: https://gorm.io/
Changes similar to: caraml-dev/xp#43
Summary of Changes
api/turing/service/router_service.go
- Use upsert in the place of Create / Updateapi/turing/service/router_version_service.go
- Use router version ID to test Create / Update. Where foreign key record creation is involved (Enricher / Ensembler), upsert cannot be used. Previously, theNewRecord
function was testing the same thing. See: Is there an equivalent to *gorm.DB.NewRecord() that was in GORM 1? go-gorm/gorm#3400 and db.NewRecord() return false when I insert something first time go-gorm/gorm#1044Count()
query works withint64
now, as opposed toint
.api/turing/service/ensembler_service.go
,api/turing/service/ensembling_job_service.go
- The concurrent count query has been modified to serial execution as it sometimes causes data race in tests. As such, the gain may not be significant.api/turing/models/pyfunc_ensembler.go
- UpdateBeforeCreate
to match the new signature -gorm.Scope
has been removed.