fix(drizzle): hasMany joins - localized, limit and schema paths (#8633)

Fixes https://github.com/payloadcms/payload/issues/8630

- Fixes `hasMany: true` and `localized: true` on the foreign field
- Adds `limit` to the subquery instead of hardcoded `11`.
- Adds the schema path `field.on` to the subquery, without this having 2
or more relationship fields to the same collection breaks joins
- Properly checks if the field is `hasMany`
This commit is contained in:
Sasha
2024-10-10 19:58:30 +03:00
committed by GitHub
parent 1dcae37e58
commit f6acfdb1f5
8 changed files with 132 additions and 13 deletions

View File

@@ -55,6 +55,12 @@ export const Categories: CollectionConfig = {
collection: postsSlug,
on: 'categories',
},
{
name: 'hasManyPostsLocalized',
type: 'join',
collection: postsSlug,
on: 'categoriesLocalized',
},
{
name: 'group',
type: 'group',