payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.88k stars 1.58k forks source link

Incomplete fix of localized blocks and array fields #7950

Closed yobottehg closed 2 months ago

yobottehg commented 2 months ago

Link to reproduction

No response

Environment Info

docker compose exec cms npm run payload info

> babu-cms@1.0.0 payload
> payload info

Binaries:
  Node: 20.17.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.0.0-beta.95
  next: 15.0.0-canary.104
  @payloadcms/db-postgres: 3.0.0-beta.95
  @payloadcms/email-nodemailer: 3.0.0-beta.95
  @payloadcms/graphql: 3.0.0-beta.95
  @payloadcms/next/utilities: 3.0.0-beta.95
  @payloadcms/plugin-form-builder: 3.0.0-beta.95
  @payloadcms/plugin-redirects: 3.0.0-beta.95
  @payloadcms/plugin-search: 3.0.0-beta.95
  @payloadcms/plugin-seo: 3.0.0-beta.95
  @payloadcms/richtext-lexical: 3.0.0-beta.95
  @payloadcms/translations: 3.0.0-beta.95
  @payloadcms/ui/shared: 3.0.0-beta.95
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: linux
  Arch: arm64
  Version: #1 SMP Wed Jul 17 10:51:09 UTC 2024
  Available memory (MB): 15975
  Available CPU cores: 8

Describe the Bug

1.Generated migrations Running the generated migrations of https://github.com/payloadcms/payload/pull/7900 does not work because it will generate columns named _locale which can not be null but will be null for existing content as it has no default.

2. Lost content If I add a default for the locale to the generated migrations with e.g DEFAULT 'de'(Currently unsure if this will result in lost content because of this primitive default) then afterwards all link references will be broken (Links labels and references will be gone. This is the case for all existing localized blocks and array fields.

3. Storing new content New content for link labels inside localized blocks and array can not be stored anymore.

Reproduction Steps

For 1 and 2:

  1. Have existing content inside a localized blocks or array field with beta 94.
  2. Upgrade to beta 95
  3. Generate the migrations
  4. Run the migrations

For 3:

  1. Have an empty localized blocks or array or links field
  2. Add a block with a link or link inside with a reference and a label
  3. Save the page
  4. Link labels are gone.

Adapters and Plugins

db-postgres

yobottehg commented 2 months ago

For someone coming here:

3 was fixed by https://github.com/payloadcms/payload/pull/7962

For 1 and 2:

github-actions[bot] commented 1 month ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.