-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgres migrations should not trigger if the unique key is too long #1515
Comments
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 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 (Not 100% on all of this, working from memory) |
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: