Skip to content

Commit

Permalink
Change the type of resource reference payload column (#1905)
Browse files Browse the repository at this point in the history
Gorm doesn't automatically change the type of a column. This changes introduced a column type change which might not be effective for an existing cluster doing upgrade. 
4e43750#diff-c4afa92d7e54eecff0a482cf57490aa8R40

/assign @hongye-sun
  • Loading branch information
IronPan authored and k8s-ci-robot committed Aug 21, 2019
1 parent a4991fd commit 3b7340f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/src/apiserver/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ func initDBClient(initConnectionTimeout time.Duration) *storage.DB {
if response.Error != nil {
glog.Fatalf("Failed to initialize the databases.")
}

response = db.Model(&model.ResourceReference{}).ModifyColumn("Payload", "longtext")
if response.Error != nil {
glog.Fatalf("Failed to update the resource reference payload type. Error: %s", response.Error)
}

response = db.Model(&model.RunMetric{}).
AddForeignKey("RunUUID", "run_details(UUID)", "CASCADE" /* onDelete */, "CASCADE" /* update */)
if response.Error != nil {
Expand Down

0 comments on commit 3b7340f

Please sign in to comment.