cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the namespace prefix of the content model that is already in use

sjoshee
Confirmed Champ
Confirmed Champ

I have the custom content model with the namespace (rma:model) and the namespace prefix "rma". This model is used by more than a million documents.  Alfresco record management uses the "rma" namespace prefix. Because of the namespace prefix collision, I am not able to install the RM Module 2.5.2 in Alfresco 5.1.4. I am trying to change the namespace prefix through the database but I am not able to locate prefix in any of the tables in the Alfresco database.

My plan is to update the prefix to "uarma" in the database and update the custom content model in the content store to reflect the new prefix.

Any insight or suggestions on this?

Thanks in advance.

4 REPLIES 4

sercama
Confirmed Champ
Confirmed Champ

Hi Suresh Joshee‌,

The problem which you describe in this post is very critical. First of all, you have to make a full backup of you contentstore, database, alfresco-global.properties and war files.

I think it isn’t good idea update manually the namespace in database. Probably you will have inconsistent data and Alfresco crashes.

I should duplicate all your model. For example, if you have a type named rma:mytype, you should create another named uarma:mytype. 

After that, you should install the new model and you should decelop a javascript script for migrate nodes from “old type” to “new type”.  In this script, you should copy all of properties from old node to new node and delete old node.

When you finish this task, you can remove elenents with namespace rma from your model and install new version of your custom module. Before that, please be sure that nodes with rma namespace don’t remain in your Alfresco.

I hope my answer can be useful for you.

Regards,

Sergio.

Thank you, Sergio, for your quick response.

I am planning to do this way but due to versioning, the content store will be increased by 1.5 TB. 

Regards

Suresh

afaust
Legendary Innovator
Legendary Innovator

Since Alfresco does not store the prefix for a namespace in the database, it should actually be quite simple to change the prefix (unless you are using the Content Model Manager). Simply modify your model definition XML to use a different prefix for the affected namespace and restart your Alfresco server with the new model XML. Since prefixes are resolved at runtime using the database stored namespace and the model provided prefix, Alfresco should now transparently use the new prefix.

Note:

  • All existing code / rules / non-standard config and property values that might store a qualified name (QName) with the old prefix need to be found and modified to adapt to the prefix change
  • You will have to delete your existing SOLR index, model and content caches to trigger a full index rebuild, otherwise any searches will not work correctly and SOLR will most likely stop indexing any changes
  • Existing audit data will not be updated transparently and continue to show the old (conflicting) prefix
  • All of this should be tried and tested first in a dev / test environment, obviously

sjoshee
Confirmed Champ
Confirmed Champ

Thank you, Axel,

I will try this and let you know.

Regards

Suresh