-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WIP]chore(backend): migrate GORM v1 to v2 #11929
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @kaikaila. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
🚫 This command cannot be processed. Only organization members or owners can use the commands. |
@kaikaila: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
🚫 This command cannot be processed. Only organization members or owners can use the commands. |
/ok-to-test |
0d52103
to
746617a
Compare
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
upgrade GORM v1 to v2 for db_fake.go. Need testing upgrade GORM v2 for apiserver/storage/job and run.go Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
…Index/AddUniqueIndex calls. Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
8b74759
to
a8f55db
Compare
…s struct Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
This reverts commit c7d4c19. Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Signed-off-by: kaikaila <[email protected]>
Summary
This PR migrates the entire ORM layer of the Kubeflow Pipelines backend from GORM v1 (
github.com/jinzhu/gorm
) to GORM v2 (gorm.io/gorm
), covering:backend/src/apiserver/model
backend/src/cache/...
Migration Details
Models Migration (GORM v1 → v2)
gorm:"primary_key"
withgorm:"primaryKey"
sql.Null*
fields are handled consistently (where applicable)NewRecord()
to.Create().Error
-based flowAutoMigrate()
calls to conform to GORM v2 APIsExecution Cache Migration
NewFakeDB
,ClientManager
, and associated test helpers to GORM v2execution_cache_store.go
to usedb.Create(...).Scan(...)
patternsNewRecord()
usage and added structured error wrappingExecutionCacheKey
to match v1 behavior (tests rely on repeated keys + latest record retrieval)Client Manager Migration
Changes
• Remove manual index creation block in InitDBClient (client_manager.go).
• Add type:varchar(191) + index:...,priority:... tags in:
• model.Run.ExperimentId and model.Run.Namespace
• model.RunDetails.Conditions and model.RunDetails.FinishedAtInSec
• model.RunDetails.CreatedAtInSec
• Add uniqueIndex:name_namespace_index,priority:... tags in model.Pipeline.Name and model.Pipeline.Namespace
• Retain original index names for backward compatibility and least-surprise.
Notes
This PR supersedes any previous model-level-only migration PRs (e.g.,
chore/orm-migrate-resource-reference
) by consolidating all ORM transitions into a unified update.It also ensures that GORM v1 is no longer referenced anywhere in the backend codebase.
Checklist
go test ./backend/...
)go.mod
and imports updated to use GORM v2