Open pixelplant opened 1 year ago
see the notes regarding the MAX aggregate and UUIDs on PostgreSQL => https://laravel.com/docs/10.x/eloquent-relationships#has-one-of-many
Not a bug with the package - as you noted it's based on the max
call which isn't supported on PostgreSQL UUIDs. So don't use UUIDs or don't use the translation
relationship.
Describe the bug After the upgrade to 11.12 (since we need Laravel 10 support) our translations are broken. The main table using translations has an UUID key used for the getTranslationRelationKey(), so imagine having a table called "properties" with an "uuid" primary key and the translations are stored in property_translations.
To Reproduce Make sure you're using a postgresql DB Use any eloquent model that has an uuid primary key, let's say it's called Property. Call the translations method on it:
and see the following error:
Expected behavior Translations should work as before
Screenshots If applicable, add screenshots to help explain your problem.
Versions (please complete the following information)
Additional context It's linked to the "translation" call in the Relationship.php trait New code with error calls 'max' on the ofMany relationship
Old code which worked did not call max and worked fine
Exception
Stack Trace The full stack trace of the thrown exception.