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
Document required migration/backfill when enabling drafts on collections with existing documents #16730
When enabling versions.drafts on a collection that already contains documents, existing documents may disappear from the admin list until corresponding version records are created or the field versioning is disabled.
This behavior has come up in previous issues, including:
Based on the discussion in #3910, this appears to be expected behavior unless a manual migration/backfill is performed. The admin list for draft-enabled collections can depend on records in the versions collection/table. If existing documents were created before drafts were enabled, they may not have corresponding version rows, so they do not appear in the admin UI.
Suggested Documentation Improvement
The docs for versions / drafts should explicitly warn users that enabling drafts on an existing collection with existing documents requires a migration or backfill step.
For example, the docs could include a warning like:
If you enable versions.drafts on a collection that already contains documents, existing documents may not appear in the admin list until version records are created for them. You may need to run a migration or resave/republish existing documents to create the required version entries.
In addition to the warning text, it would be helpful to include a migration/backfill example, or to support this through automatic data migration when versioning/drafts are enabled on a collection that already has existing content.
Example Scenario
Create a collection without versions or drafts enabled.
Add documents to the collection.
Later update the collection config to enable drafts:
versions: {drafts: true,}
Why This Matters
The current behavior can look like data loss because the documents still exist in the database, but the admin list appears empty. Clear documentation would help users understand that this is a migration/backfill issue rather than actual data deletion.
Reacted by flokleber, Kim Brandwijk, mimimi and Ming-Long Huang
Activity
chore: add six more upstream fixes and regression coverage
fix: address 24 Payload read, schema, version and tooling reports (#9)