I'm migrating an ancient blog from PostgreSQL to Contentful. I'd like to use data from the old blog posts to fill in Contentful entries' sys.createdAt
, sys.updatedAt
, sys.publishedAt
, and sys.firstPublishedAt
.
I've read through:
Didn't find anything.
I've read a couple of examples where people create their own publishedAt
field in a content type rather than add to sys
date properties.
I tried to replicate the data structure of exported content as exported by contentful-cli and filled in the date properties with my own data:
// I edited these dates
"createdAt": "2020-09-05T13:14:00.768Z",
"updatedAt": "2021-06-05T13:14:20.303Z",
...
"publishedAt": "2021-06-05T13:14:20.303Z",
"firstPublishedAt": "2020-10-05T13:14:20.303Z",
Then I imported the JSON file with the same CLI. This did not work.
I also tried importing a file exported with contentful space export
with no custom edits in it. It turns out, Contentful always uses the time of import for all entry date properties regardless of the dates in the exported file.
It says somewhere in relation to the Content Delivery API that we can't edit sys
. But I've not seen it explicitly stated that we can't do it with the CMA or the migration tools. Is it really not possible to add those details for the purpose of migration?
Contentful DevRel here. 👋
You're correct. The sys
object contains system-managed metadata and its fields can not be changed programmatically. It doesn't matter if you use the official tooling.
(The only exception is that you can specify sys.id
on entry creation.)
I've read a couple of examples where people create their own
publishedAt
field in a content type rather than add to sys date properties.
👆 That is the recommended way to go. For any data you want to control, create new fields and manage them however you like.