Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ntapsrigowri
Copy link

@ntapsrigowri ntapsrigowri commented Oct 3, 2025

GH-1496 : fix: support composite foreign keys in cascade delete operations

  • Fixed getFieldFromRelationshipWhere to iterate over all FK columns
  • Fixed getFieldRelationshipWhere to handle all composite key columns
  • Fixed getFieldToRelationshipWhere for completeness
  • Previously only the first column was checked, causing over-broad cascades
  • Now all columns in relationFromFields/relationToFields are used
  • Prevents unintended deletion of child rows with matching first FK column

Fixes composite foreign key cascade behavior to match real database operations

fix: support composite foreign keys in cascade delete operations

- Fixed getFieldFromRelationshipWhere to iterate over all FK columns
- Fixed getFieldRelationshipWhere to handle all composite key columns
- Fixed getFieldToRelationshipWhere for completeness
- Previously only the first column was checked, causing over-broad cascades
- Now all columns in relationFromFields/relationToFields are used
- Prevents unintended deletion of child rows with matching first FK column

Fixes composite foreign key cascade behavior to match real database operations
@ntapsrigowri ntapsrigowri changed the title Update find.ts Fix: Support composite foreign keys in cascade delete operations - Update find.ts Oct 3, 2025
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.

1 participant