I would like to update the metadata_created field for a number of datasets (that were migrated from a previous system and so have incorrect creation times in CKAN).
I tried using the ckanapi to do this, but the field cannot be updated with the API, as previously noted here: CKAN: update metadata_created and metadata_modified infos
I then tried updating the metadata_created field in the package table directly via psql:
ckan=> select id, metadata_created, metadata_modified from package where id = 'a0f8e50d-aa28-4c5a-8aca-818d920244c9';
id | metadata_created | metadata_modified
--------------------------------------+---------------------------+----------------------------
a0f8e50d-aa28-4c5a-8aca-818d920244c9 | 2023-07-07 07:27:52.60954 | 2023-07-25 06:03:54.922081
(1 row)
ckan=> update package
set metadata_created = '1999-12-31T23:59:59'
where id = 'a0f8e50d-aa28-4c5a-8aca-818d920244c9'; UPDATE 1
ckan=> select id, metadata_created, metadata_modified from package where id = 'a0f8e50d-aa28-4c5a-8aca-818d920244c9';
id | metadata_created | metadata_modified
--------------------------------------+---------------------+----------------------------
a0f8e50d-aa28-4c5a-8aca-818d920244c9 | 1999-12-31 23:59:59 | 2023-07-25 06:03:54.922081
(1 row)
.. but this is not subsequently reflected by the API/UI:
$ ckanapi action package_show id=a0f8e50d-aa28-4c5a-8aca-818d920244c9 -r https://our.ckan.tld | jq '.metadata_created'
"2023-07-07T07:27:52.609540"
Is there a cache that needs to be flushed/refreshed, in order for this update to become visible?
(Note that making a trivial change to some other field in the dataset - via the API - seems to make the update visible, but that's not a practical solution for the large number of records that we need to update).
Thanks.
Robert.
I updated the package table row with the required value of metadata_created and expected this to be reflected in the UI/API.
The solution to this turned out to be a rebuild of the Solr index, which we achieved by running this command from one of the CKAN containers:
After running the above, the metadata timestamps from the 'ckanapi' matched those in the postgres DB.