Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Bug Report payload 1.6.19-20

default discord avatar
ronok9922 years ago
3

Enabling versioning in old collection. Does not show data on dashboard. but the data exist in db. If new data is add it is shown in dashboard.

  • default discord avatar
    arskeliss2 years ago

    I have the same issue, i had data in the collection and after enabling versions it dissappeared, but the data was still in my db. Also, took new data without problem.

  • discord user avatar
    jarrod_not_jared
    2 years ago

    Yeah so this is to be expected when flipping the switch on versions.



    Let me do my best to explain the issue here, and then how to resolve it.



    With versions enabled, a new collection will be created for the main collection - in your case it would be

    _tests_versions

    . When a document is saved, updated, deleted the corresponding versions collection will have a copy of the document created there. 5 separate updates to the main document means 5 versions will be created.



    Now, the admin panel dashboard always fetches from the versions collection so it can display the most up-to-date document. In your case, your documents were created before the versions table existed so it did not save any there. The admin panel goes to query the versions table and returns only the ones that you have recently saved after enabling versions.



    To resolve this, you can run the script in the following release notes that will loop over documents in your main collection and ensure every doc has at least 1 version doc. This way when you go to the admin panel you will see them all there. You will only need to run this script once for this collection, since it will create the first version for each doc that does not already have a version saved.



    Jump to the "Versions may need to be migrated" section here:

    https://github.com/payloadcms/payload/releases/tag/v1.6.1
  • default discord avatar
    ronok9922 years ago

    Thanks it worked..

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.