Skip to content

plugin-import-export is not able to import its own exported collections with 1:N relationship #17110

Description

Describe the Bug

Image

I created a "Campaign" slug with these field:

  fields: [
    {
      name: 'name',
      type: 'text',
      required: true,
    },
    {
      name: 'description',
      type: 'text',
      required: true,
    },
    {
      name: 'events',
      type: 'relationship',
      relationTo: 'event',
      hasMany: true,
    },
  ],

As it is seen in the image, the generated event_# columns are ignored when importing, and the resulting events columns is empty.

Link to the code that reproduces this issue

https://github.com/pinuts-SebastianGolbert/payload-import-issue

Reproduction Steps

Export campaigns

Try to import campaigns

This can be reproduced more faithfully by using different sqlLite dbs in the .env file (one for export, one for import), but it can also be done with the preview function.

Which area(s) are affected?

plugin: import-export

Environment Info

Binaries:
  Node: 22.22.2
  npm: 10.9.7
  Yarn: 1.22.22
  pnpm: 10.34.3
Relevant Packages:
  payload: 3.85.1
  next: 16.2.6
  @payloadcms/db-sqlite: 3.85.1
  @payloadcms/drizzle: 3.85.1
  @payloadcms/graphql: 3.85.1
  @payloadcms/next/utilities: 3.85.1
  @payloadcms/plugin-import-export: 3.85.1
  @payloadcms/richtext-lexical: 3.85.1
  @payloadcms/translations: 3.85.1
  @payloadcms/ui/shared: 3.85.1
  react: 19.2.6
  react-dom: 19.2.6
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.5.0: Mon Apr 27 20:38:56 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions