fix: modify field name uniqueness constraint to only apply to UUID fields #33
+9
−3
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.
Summary
Ports a bug fix from constructive-db that modifies the field name uniqueness constraint to only apply name normalization (stripping
_id,_uuid,_fk,_pk,_row_idsuffixes) to UUID fields.Previously, the constraint normalized ALL field names, which caused false collisions on text fields. For example, two legitimate text fields
current_roleandcurrent_role_idwould both normalize tocurrent_roleand conflict, even though they're different fields.The fix adds a
CASE WHEN type = 'uuid'check so normalization only applies to UUID fields (the actual FK candidates where this behavior is intended).Review & Testing Checklist for Human
Notes
This fix was originally made in constructive-db (commit
b0dce8dd4) and is being upstreamed to this repo.Link to Devin run: https://app.devin.ai/sessions/e768febe8d1f41f9b9b6c4bab0bc5d80
Requested by: Dan Lynch (@pyramation)