Improve the creation of constraints and indices

Description

The handling of unique constraints was somewhat improved by HHH-7797's addition of Dialect#uniqueDelegate. However, more is needed.

We need a way to handle all variations of:

  • unique vs. not unique

  • JPA @Index vs. no index

  • JPA @Index(unique = true) vs. @Index(unique = false)

suggestion: Dialect#applyConstraints( table, model) & Dialect#dropConstraints( table, model)

Additional requirements:

  • log warning if mapping/dialect would result in duplicate indices

  • don't assume the structure of creation commands (ex: Teradata expects "create index [name]([column]...) on [table]", not "create index [name] on [table] ([column]...)")

  • don't assume the structure of creation and drop commands are similar (ex: MySQL unique creation uses a constraint, but dropping it must use index)

Remove deprecated unique/constraint methods in Dialect.

Activity

Fixed

Details

Assignee

Reporter

Priority

Created November 22, 2013 at 6:09 PM
Updated December 3, 2024 at 12:44 PM
Resolved February 14, 2014 at 2:41 PM