-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Join field breaks when put on collection with versions #9369
Comments
🚀 This is included in version v3.1.0 |
Just a heads up, I'm still getting the same error after upgrading to 3.1.0. Using the same reproduction. |
Hey Alexander, can you please ensure you are on the latest version? Delete I'm sure I had this specific error in my tests and it was gone after. |
I used this config: import type { CollectionConfig } from 'payload'
export const versionsSlug = 'versions'
export const Versions: CollectionConfig = {
slug: versionsSlug,
fields: [
{
name: 'category',
relationTo: 'categories',
type: 'relationship',
},
{
name: 'categoryVersion',
relationTo: 'categories-versions',
type: 'relationship',
},
{
name: 'categoryVersions',
relationTo: 'categories-versions',
type: 'relationship',
hasMany: true,
},
],
versions: {
drafts: true,
},
} import type { CollectionConfig } from 'payload'
import { versionsSlug } from './Versions.js'
export const categoriesVersionsSlug = 'categories-versions'
export const CategoriesVersions: CollectionConfig = {
slug: categoriesVersionsSlug,
fields: [
{
name: 'relatedVersions',
type: 'join',
collection: versionsSlug,
on: 'categoryVersion',
},
{
name: 'relatedVersionsMany',
type: 'join',
collection: versionsSlug,
on: 'categoryVersions',
},
],
versions: {
drafts: true,
},
} |
This issue has been automatically locked. |
Describe the Bug
Join field breaks when put on a collection with versions. For example, Pages have a relation to Posts. Posts join to Pages. Both collections have versions. This error shows up
[ Server ] Error: column pages_rels._posts_v_id does not exist
It could be that versions on both are required for the bug to present itself. Join works if the collection being joined TO (Pages in this example) has versions and Posts doesn't.
Link to the code that reproduces this issue
https://github.com/alexanderbnelson/payload-example
Reproduction Steps
View the code for the posts collection config.
https://github.com/alexanderbnelson/payload-example/blob/main/src/collections/Posts/index.ts
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: