Content Server Manual / Version 2307
Table Of ContentsCaution
Before you delete content types, make sure that the data is no longer needed.
Preliminary Considerations
Deletion of content types is a challenging task, mostly because of structs (see Section 4.3.2, “Struct Properties”) and content versions:
A struct might have a link property to the to-be-deleted content type. If this link property is not used (= does not link to an actual content), it is hard to find and change. If you delete the content type and start the server, you will get problems.
Older versions of a content might link to the to-be-deleted content type. You can use the cleanversions tool (see Section, “Clean Versions”) to delete older versions, but the tool makes some exceptions which complicate the task, especially for newly referenced versions.
Due to the aforementioned challenges, CoreMedia recommends not deleting the content type immediately, but to follow these steps:
Discontinue the use of the content type in your team.
- Disable the creation of the content type in Studio (see Section 9.5.6, “Excluding Document Types from the Library” in Studio Developer Manual) and disable the selection of the content type in the struct editor.
Delete content items of the to-be-deleted content type from the repository. Follow the description in Section “Deleting content from the repository”.
Wait a few weeks or more for sufficient editorial changes, so that more and more versions referring to outdated content type are replaced by new ones. The longer you wait, the easier the subsequent steps are.
Use cleanversions to delete older versions which might still refer to the to be deleted content type. Follow the steps described in Section “Deleting older version with cleanversion”.
Delete the content type and all references from the content type definition file and the database. Follow the description in Section “Deleting content type from database and content type definition”.
Deleting content from the repository
Delete all content items of the to-be-deleted content type from the content repository.
Use a JShell script or a UAPI client to select all content items of the content type to delete.
Find all referrers to this content (from link lists, richtext fields, Structs...) and decide what to do (delete the link, link to other content ...). For link lists you can use the validate-link-type tool (see Section 3.13.1.10, “Validate Link Type”).
Find all link or link list properties in struct properties whose link type is the to-be-deleted content type. Change the link type or remove the properties.
Publish all changed content, so that no old version is the latest published version.
Withdraw all to-be-deleted content.
Delete the content.
Deleting older version with cleanversion
At this point, you have deleted all content items of the to-be-deleted content type from the repository. No other current content item links to this type. However, there might be older versions of content items which still link to the type.
You can use cleanversions to delete these older versions. However, all content versions which are still in use will not be deleted (read the section about default exclusions in Section, “Clean Versions”).
Run cm cleanversions (see Section, “Clean Versions”) to clear any unused versions. If you do not want to apply it globally, search for all content versions containing links in Struct properties whose link type is the to-be-deleted content type. Ensure to use
--keep-number=1
to delete as many versions as possible.Validate content state using UAPI tooling to see contents/versions which are still blocking deletion.
When there are still blocking content/version, consider the following options:
Especially in multi-site scenarios you might have to abort existing translation workflows and trigger a new translation workflow with the current content version.
- Wait some more time to get rid of the blocking versions and start again with step 1.
Decide on alternative actions to get rid of remaining contents/versions.
Deleting content type from database and content type definition
Now, you have removed all content items of the to-be-deleted type from the repository and no other items link to the type. Delete the last occurrences of the type in rules and from the recycle bin and ultimately from the content type definition file.
Delete all rules that are attached to the conent type by using the User Manager or by setting the following SQL statement (stop the Content Servers before applying the SQL statement). You have to apply the SQL statement at all Content Server databases:
DELETE FROM CmRules WHERE doctype = '<docTypeName>';
If the rules are deleted by using SQL, all servers and clients need to be restarted, as the content type is being cached.
Use the
cleanrecyclebin
utility to remove all the content items from the recycle bin.Stop the Content Management Server and the Live Servers.
Remove the content types to delete from the content types definition files of all Content Servers. Change the
LinkType
property of link list properties to a new content type.Verify that the table which represents the content type is empty (see Section 4.3.1, “The Database Schema” for details about the database schema).
Drop the table which represents the content type from the databases.
Start the Content Servers again.