-
Notifications
You must be signed in to change notification settings - Fork 114
Trt-1989: partition management #3334
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: main
Are you sure you want to change the base?
Changes from 2 commits
bf6747b
af7e262
b2d93df
98d456e
a297fe9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,8 +77,6 @@ func (d *DB) UpdateSchema(reportEnd *time.Time) error { | |
| &models.ProwJobRunAnnotation{}, | ||
| &models.Test{}, | ||
| &models.Suite{}, | ||
| &models.ProwJobRunTest{}, | ||
| &models.ProwJobRunTestOutput{}, | ||
| &models.APISnapshot{}, | ||
| &models.Bug{}, | ||
| &models.ProwPullRequest{}, | ||
|
|
@@ -111,6 +109,27 @@ func (d *DB) UpdateSchema(reportEnd *time.Time) error { | |
| } | ||
| } | ||
|
|
||
| // handle partitioned model management outside of gorm | ||
| partitionedModelsToMigrate := []struct { | ||
| model interface{} | ||
| tableName string | ||
| }{ | ||
| { | ||
| model: &models.ProwJobRunTest{}, | ||
| tableName: "prow_job_run_tests", | ||
| }, | ||
| { | ||
| model: &models.ProwJobRunTestOutput{}, | ||
| tableName: "prow_job_run_tests_outputs", | ||
| }, | ||
| } | ||
|
|
||
| for _, partitionedModel := range partitionedModelsToMigrate { | ||
| if _, err := d.UpdatePartitionedTable(partitionedModel.model, partitionedModel.tableName, false, false); err != nil { | ||
| return err | ||
|
Comment on lines
+127
to
+129
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This path only works if the partitioned tables already exist.
🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
| if err := createAuditLogIndexes(d.DB); err != nil { | ||
| return err | ||
| } | ||
|
|
@@ -123,6 +142,7 @@ func (d *DB) UpdateSchema(reportEnd *time.Time) error { | |
| return err | ||
| } | ||
|
|
||
| // TODO(fbabcock): migrate this to UpdatePartitionedTable | ||
| if err := syncPartitionedTables(d.DB); err != nil { | ||
| return err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.