Skip to content

Fix double unique field generation when 1 element unique array#49

Merged
m1212e merged 1 commit intom1212e:mainfrom
Pastequee:fix/unique-double-generation
Dec 9, 2025
Merged

Fix double unique field generation when 1 element unique array#49
m1212e merged 1 commit intom1212e:mainfrom
Pastequee:fix/unique-double-generation

Conversation

@Pastequee
Copy link

@Pastequee Pastequee commented Dec 6, 2025

Addresses #48

The issue was that the generation was done for uniqueCompositeFields AND for uniqueFields

Because the it appears as ["blah"] in the data.uniqueFields AND is tagged as field.isUnique -> true.

Solution: filter the uniqueCompositeFields to only compute for the data.uniqueFields with more than one element

PS: most of the changes come from biome formating, I just added .filter((fields) => fields.length > 1)

@m1212e
Copy link
Owner

m1212e commented Dec 9, 2025

Hey, thanks a lot!

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.

Bug Report: Duplicate field definitions in generated WhereUnique schemas with single-field @@unique constraints

2 participants