Skip to content

Fix FK violations in unique constraint migrations for security_groups and buildpacks#5069

Merged
johha merged 1 commit intocloudfoundry:mainfrom
sap-contributions:fix/securitygroup-unique-index-reference
Apr 28, 2026
Merged

Fix FK violations in unique constraint migrations for security_groups and buildpacks#5069
johha merged 1 commit intocloudfoundry:mainfrom
sap-contributions:fix/securitygroup-unique-index-reference

Conversation

@serdarozerr
Copy link
Copy Markdown
Contributor

@serdarozerr serdarozerr commented Apr 28, 2026

Both migrations deleted duplicate rows via raw SQL, bypassing Sequel model hooks and causing FK constraint violations on child tables. Fixed by deleting child rows first, security_groups_spaces/staging_security_groups_spaces for security_groups, and buildpack_annotations/buildpack_labels for buildpacks. Tests extended to cover the FK reference scenario in both specs.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

… and buildpacks

Both migrations deleted duplicate rows directly via raw SQL, bypassing
Sequel's association hooks. This caused FK constraint violations because
referenced child rows were not cleaned up first.
@johha johha merged commit 23ead3c into cloudfoundry:main Apr 28, 2026
16 checks passed
@johha johha deleted the fix/securitygroup-unique-index-reference branch April 28, 2026 12:56
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request Apr 28, 2026
Changes in cloud_controller_ng:

- Fix FK violations in unique constraint migrations for security_groups and buildpacks
    PR: cloudfoundry/cloud_controller_ng#5069
    Author: serdar özer <serdar.oezer@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants