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.83k stars 1.58k forks source link

Last modified and Created At always the same #7915

Closed artemszelenov closed 1 month ago

artemszelenov commented 2 months ago

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: N/A
  pnpm: 9.5.0
Relevant Packages:
  payload: 3.0.0-beta.94
  next: 15.0.0-canary.104
  @payloadcms/db-postgres: 3.0.0-beta.94
  @payloadcms/email-nodemailer: 3.0.0-beta.94
  @payloadcms/graphql: 3.0.0-beta.94
  @payloadcms/next/utilities: 3.0.0-beta.94
  @payloadcms/plugin-cloud: 3.0.0-beta.94
  @payloadcms/richtext-lexical: 3.0.0-beta.94
  @payloadcms/translations: 3.0.0-beta.94
  @payloadcms/ui/shared: 3.0.0-beta.94
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12

Describe the Bug

Last modified and Created At always the same. I expect that when I modify an article and save it Last modified should be updated but Created At stayed the same.

Screenshot 2024-08-28 at 17 49 37

Reproduction Steps

  1. create a doc
  2. modify and publish

Adapters and Plugins

db-postgres

DanRibbens commented 2 months ago

I think the key to this issue is that you are "publishing". We should be getting the createdAt off of the initial document and not the versions document.

We have some int tests for databases in test/database/int.spec.ts that cover different handling of createdAt and updatedAt and this would be good to add to tests/versions/int.spec.ts as well.

r1tsuu commented 1 month ago

Fixed in https://github.com/payloadcms/payload/pull/8160

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.

denolfe commented 1 month ago

🚀 This is included in version v3.0.0-beta.105