-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
make collection_id primary key for segment, fix system tests #1731
Changes from all commits
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 |
---|---|---|
|
@@ -165,20 +165,23 @@ func generateSegmentUpdatesWithoutID(in *dbmodel.UpdateSegment) map[string]inter | |
} | ||
} | ||
|
||
if in.ResetCollection { | ||
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. Why comment out this code? 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. I don't see why we need to set collection id to null. And it is not possible to do it because collection_id is now primary key of segment |
||
if in.Collection == nil { | ||
ret["collection_id"] = nil | ||
} | ||
} else { | ||
if in.Collection != nil { | ||
ret["collection_id"] = *in.Collection | ||
} | ||
} | ||
log.Info("generate segment updates without id", zap.Any("updates", ret)) | ||
// TODO: check this | ||
//if in.ResetCollection { | ||
// if in.Collection == nil { | ||
// ret["collection_id"] = nil | ||
// } | ||
//} else { | ||
// if in.Collection != nil { | ||
// ret["collection_id"] = *in.Collection | ||
// } | ||
//} | ||
//log.Info("generate segment updates without id", zap.Any("updates", ret)) | ||
return ret | ||
} | ||
|
||
func (s *segmentDb) Update(in *dbmodel.UpdateSegment) error { | ||
updates := generateSegmentUpdatesWithoutID(in) | ||
return s.db.Model(&dbmodel.Segment{}).Where("id = ?", in.ID).Updates(updates).Error | ||
return s.db.Model(&dbmodel.Segment{}). | ||
Where("collection_id = ?", &in.Collection). | ||
Where("id = ?", in.ID).Updates(updates).Error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why comment these tests? These tests are ported from the python system test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why we need to set collection id to null or modify the collection id for a segment. And it is not possible to do it because collection_id is now primary key of segment