borinquenkid opened a new pull request, #16533: URL: https://github.com/apache/grails-core/pull/16533
## Problem Two defects of `unique: [...]` groups: - **Enum:** a group containing an enum property creates no key (`EnumTypeBinder` never runs the unique key creation `ColumnBinder` does), so duplicates are accepted. - **Collection:** a group on a collection property creates a key over a column the collection table lacks (`(x, owner_id)` where the collection table has no `x`); the table fails to create and the first insert fails with "Table ..._TAGS not found". Hibernate 5 has both defects (confirmed by reading its source). ## Fix `EnumTypeBinder` calls `CreateKeyForProps` for the enum column (both the `mapping` and `constraints` spellings). `CreateKeyForProps` makes no key for a to-many property, since its table does not hold the other group columns. ## Risk Low. Enum groups now get a database key, so a duplicate that used to slip through now fails at the database. ## Tests New `UniqueGroupEnumAndCollectionSpec`, rows in `CreateKeyForPropsSpec` and `EnumTypeBinderSpec`; the unit rows and the runtime duplicate-insert check failed before. `grails.gorm.*` and `org.grails.orm.hibernate.*`: 3042 tests, 0 failures after fixing one expected name in a new row. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
