-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thanks for sending a pull request! Here are some tips for you: 1. Run unit tests and ensure that they are passing 2. If your change introduces any API changes, make sure to update the e2e tests 3. Make sure documentation is updated for your PR! --> **What this PR does / why we need it**: <!-- Explain here the context and why you're making the change. What is the problem you're trying to solve. ---> Upgrading the dependency on Gorm from `github.com/jinzhu/gorm v1.9.11` to [Gorm v2](https://gorm.io/) @ `v1.24.0`. Some minor refactoring of the DB connection layer has been done. Notable changes: * Function `gorm.IsRecordNotFoundError` is removed. Checks replaced by: `errors.Is(err, gorm.ErrRecordNotFound)` * Gorm's tag `association_foreignkey` is changed to `references`. * Count() query works with `int64` now, as opposed to `int`. * `it/database/` moved to -> `database/`. The functions in the new package are largely similar to [turing](https://github.com/caraml-dev/turing/tree/main/api/turing/database). * `api/cmd/api/main.go`, `api/cmd/api/setup.go` - Refactored the running of DB migrations for main DB and test DB into the same function `migrateDB` in the `database/` package. * `github.com/pilagod/gorm-cursor-paginator` library dependency has been upgraded to match the Gorm version. There are some minor changes in the API contract and behavior. * Refactored some of the transaction rollback logic as `RollbackUnlessCommitted()` is removed in Gorm v2. * `Select("table_name.*")`, to select all columns of a table, no longer works. However, the columns selected are automatically filtered according to the type of the variables being selected into, so I removed such `Select` calls. **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> None **Does this PR introduce a user-facing change?**: <!-- If no, just write "NONE" in the release-note block below. If yes, a release note is required. Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". For more information about release notes, see kubernetes' guide here: http://git.k8s.io/community/contributors/guide/release-notes.md --> ```release-note NONE ``` **Checklist** - [ ] Added unit test, integration, and/or e2e tests - [x] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [ ] Regenerated Golang and Python client if the PR introduce API changes
- Loading branch information
1 parent
2a70a79
commit f89860f
Showing
55 changed files
with
529 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.