Replacing validate uniqueness with db constraint on RevisionSidecar model - #4950
Merged
Conversation
- DB migration added for new uniqueness constraint. Tests for the new migration is added too. - around_save method added into RevisionSidecarModel to catch new constraint and augment it with message. Sequel:validate_uniqueness removed from the model
serdarozerr
marked this pull request as ready for review
March 23, 2026 12:34
johha
previously approved these changes
Mar 23, 2026
johha
previously approved these changes
Mar 26, 2026
philippthun
reviewed
Mar 27, 2026
| let!(:revision) { VCAP::CloudController::RevisionModel.make(:app) } | ||
|
|
||
| it 'remove dublicates, add constraint and revert migration' do | ||
| # ========================================================================================= |
Member
There was a problem hiding this comment.
I think we don't use this kind of comments in other places (or we should not use them) as it makes reading harder from my point of view. A single line comment is fine.
Contributor
Author
There was a problem hiding this comment.
i have followed the previous similar migration and this comment style has been used.
philippthun
approved these changes
Apr 8, 2026
ari-wg-gitbot
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Apr 8, 2026
Changes in cloud_controller_ng:
- Replacing validate uniqueness with db constraint on RevisionProcessCommand model
PR: cloudfoundry/cloud_controller_ng#4956
Author: serdar özer <serdar.oezer@sap.com>
- Replacing validate uniqueness with db constraint on RevisionSidecar model
PR: cloudfoundry/cloud_controller_ng#4950
Author: serdar özer <serdar.oezer@sap.com>
- Replacing validate uniqueness with db constraint on Sidecar model
PR: cloudfoundry/cloud_controller_ng#4954
Author: serdar özer <serdar.oezer@sap.com>
Dependency updates in cloud_controller_ng:
- build(deps): bump addressable from 2.8.8 to 2.9.0 in /docs/v3
PR: cloudfoundry/cloud_controller_ng#4998
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a database-level unique constraint on
(revision_guid, name)in therevision_sidecarstable to prevent duplicate sidecar names per revision.Changes
around_saveinRevisionSidecarModelto convertUniqueConstraintViolationinto aValidationFailedwith a user-friendly messagevalidates_uniquefrom the model since the DB constraint now handles itaround_savebehaviorI have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests