Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #0
Problem/Motivation
Fields can specify indexes and foreign keys in their schema, but not unique keys. Specifically UUID fields should specify a unique key for their column.
Proposed resolution
Allow fields to specify unique keys.
Remaining tasks
User interface changes
-
API changes
Comment | File | Size | Author |
---|---|---|---|
#21 | 2209049-21-field-schema-unique-keys.patch | 17.14 KB | tstoeckler |
Comments
Comment #1
tstoecklerHere we go. Let's see how badly this breaks.
Comment #4
tstoecklerNice, that looks solvable...
Comment #5
tstoecklerComment #6
tstoeckler4: 2209049-4-field-unique-keys.patch queued for re-testing.
Comment #8
tstoecklerNo merge conflict, so must have been a context change.
Comment #9
tstoeckler8: 2209049-8-field-schema-unique-keys.patch queued for re-testing.
Comment #11
lokapujyaComment #13
lokapujyaComment #15
lokapujyaComment #16
lokapujyainterdiff from last patch.
Comment #17
tstoecklerAwesome @lokapujya, thanks a lot!
Anyone want to RTBC?
Comment #18
blueminds CreditAttribution: blueminds commented$unique_key_name has accent mark on the "y" letter.
Otherwise looks fine.
Comment #19
tstoecklerWow @blueminds, nice catch!
Now that #2183231: Make ContentEntityDatabaseStorage generate static database schemas for content entities is in, we can also remove the hardcoded adding of the UUID unique key from ContentEntitySchemaHandler. Also added test coverage for field unique keys now, completing the test coverage of ContentEntitySchemaHandler.
That revealed a small bug of sorts where defaults weren't applied correctly to the table schema.
Comment #21
tstoecklerLet's see if this is green.
Comment #22
blueminds CreditAttribution: blueminds commentedWent through the code, applied, tested, works, looks good.
Comment #23
alexpottCommitted c63692f and pushed to 8.x. Thanks!