You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A table with a long uniqueness key will trigger a migration, but Postgres will silently truncate it to the original length. persistent-postgresql's migrations should truncate the name of a constraint before checking if it needs to be renamed.
The text was updated successfully, but these errors were encountered:
With foreign keys, it was possible to match the names Postgres auto-generates #996
IIRC for uniqueness constraints, Persistent's DB generated name is based off the Haskell name (eg UniqueOrganizationPaymentAuthorizationControlsOrganizationId), not what database table/column names are (eg organization_id.
I think because of this, Persistent could just do a simple truncation to the max length, rather than trying to match the auto-generated names like we do for FKs
I recently checked this to explain to a new employee, and yes, the Haskell name you define will be turned into lower-snake-case and used as the uniqueness constraint name. So if there's a max length, the TH could just throw an exception and/or it could be auto-truncated (but I'd imagine that might lead to conflicts with the Haskell names being different, but the truncated ones overlapping in Postgres)
A table with a long uniqueness key will trigger a migration, but Postgres will silently truncate it to the original length.
persistent-postgresql
's migrations should truncate the name of a constraint before checking if it needs to be renamed.The text was updated successfully, but these errors were encountered: