You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enabling drafts on an existing collection makes all documents disappear in the admin view #2063
The main reason I did this was because after upgrading to 1.6 a lot of previously deleted documents showed up in the admin view. They couldn't be viewed, just gave an error it wasn't found. As such, they also couldn't be deleted. I therefore deleted the versions folder in the database and though Payload would recreate it. The only way to get any documents back into the admin view now is to keep drafts disabled for the collection (which I don't want to do)
Hey there - did you run the migration script that we released in our changelog for 1.6.0? That should have deleted all old / unused versions. It should also make sure that all of your documents appear correctly.
I should also note that enabling drafts on a collection that already exists will also require running that migration script. We definitely need to update our documentation because I think that right now, it says that you can enable drafts without doing anything else, but that’s no longer accurate.
So the title of this issue is actually intended, and expected, although we might be able to improve this in the future. Once we introduce some type of smart, automatic migrations for config changes.
I tried the script but couldn't get it to work. The error message was cannot convert undefined or null to object at function.keys but unfortunately without line number where it occurred, so it's hard to debug
So, without running the script, everything you said makes perfect sense to me. It’s definitely a requirement that that script is run to be able to migrate if you have a lot of existing versions. We should try and figure out why it’s not running for you, and to do so if you can share with me whatever the error message is, no matter how nondescript it is, I will try and figure out what’s happening. Definitely need to get that thing going. PS I am also on mobile and doing speech to text, and I am amazed that it’s coming through as coherently as it is. Friday night!
Ok, works now 🤣. I had to upgrade first, then run the script. I was pretty sure I tried it, but apparently not 🙈. You should probably remark it in some way as it currently sounds like you have to do this as a preperation before upgrading.
The error message with version 1.5.9 just in case you're interested anyways is:
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at relationshipPopulationPromise (C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\relationshipPopulationPromise.ts:148:12)
at promise (C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\promise.ts:170:60)
at C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\traverseFields.ts:35:31
at Array.forEach (<anonymous>)
at traverseFields (C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\traverseFields.ts:34:10)
at promise (C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\promise.ts:260:21)
at C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\traverseFields.ts:35:31
at Array.forEach (<anonymous>)
at traverseFields (C:\Users\johan\Programming\SBRENT-Payload\node_modules\payload\src\fields\hooks\afterRead\traverseFields.ts:34:10)
Activity
jmikrut commentedon Feb 10, 2023
Hey there - did you run the migration script that we released in our changelog for 1.6.0? That should have deleted all old / unused versions. It should also make sure that all of your documents appear correctly.
If you haven’t tried it, will you give it a shot?
Here’s a link:
https://github.com/payloadcms/payload/blob/master/CHANGELOG.md#-versions-may-need-to-be-migrated
jmikrut commentedon Feb 10, 2023
I should also note that enabling drafts on a collection that already exists will also require running that migration script. We definitely need to update our documentation because I think that right now, it says that you can enable drafts without doing anything else, but that’s no longer accurate.
So the title of this issue is actually intended, and expected, although we might be able to improve this in the future. Once we introduce some type of smart, automatic migrations for config changes.
johannesschaffer commentedon Feb 10, 2023
I tried the script but couldn't get it to work. The error message was
cannot convert undefined or null to object at function.keysbut unfortunately without line number where it occurred, so it's hard to debugjohannesschaffer commentedon Feb 10, 2023
You should also update the docs that deletedRetention or something like that (I'm on mobile right now) isn't supported anymore
jmikrut commentedon Feb 10, 2023
So, without running the script, everything you said makes perfect sense to me. It’s definitely a requirement that that script is run to be able to migrate if you have a lot of existing versions. We should try and figure out why it’s not running for you, and to do so if you can share with me whatever the error message is, no matter how nondescript it is, I will try and figure out what’s happening. Definitely need to get that thing going. PS I am also on mobile and doing speech to text, and I am amazed that it’s coming through as coherently as it is. Friday night!
johannesschaffer commentedon Feb 10, 2023
Ok, works now 🤣. I had to upgrade first, then run the script. I was pretty sure I tried it, but apparently not 🙈. You should probably remark it in some way as it currently sounds like you have to do this as a preperation before upgrading.
The error message with version 1.5.9 just in case you're interested anyways is:
github-actions commentedon Sep 8, 2024
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.