cancel
Showing results for 
Search instead for 
Did you mean: 

Correctly removing content types and properties

tomoconnell
Champ in-the-making
Champ in-the-making
I have multiple changes I want made to an active content model with many files using this model.

If I were to just edit out the property from the model from what I have read i'm assuming that this will cause problems?
So would deleting all active instances of a property either manually or with a script and then removing the property from the xml be safe enough.

I can't afford for any data corruption or alfresco problems caused by this.
For now i'm going to just strip it from the share config so its not visible but I will eventually need to remove the redundant metadata.


Any advice or experience dealing with a situation like this would be greatly appreciated.
4 REPLIES 4

parzgnat
Star Contributor
Star Contributor
From my experience, deleting things from the content model can be very problematic.  If you're going to delete a property from a type, you would need to delete all nodes created of that type prior to reinstalling your model, which I'm guessing is not possible in your system.  Similarly, if you're deleting a property from an aspect, you would need to remove that aspect from any nodes that currently have it applied prior to reinstalling your model.  Also probably not an option.

The only other alternative is to hide that property from the user interface, which it sounds like you've already done.  Because deleting items from the model is so problematic, I usually take the approach of starting small when I create a new model and then add things as I need them, rather than adding everything that I think I'll need up from and then wishing that I could delete them down the road.  Adding to your model is much safer than removing.

Also beware of setting an aspect as mandatory on a type after objects of that type have already been created.  I messed up a repository pretty badly a while back by doing this.

You also should keep in mind what model changes might do to your index.  Depending on the type of change you're making, you may need to do a full reindex after making your model updates.

tomoconnell
Champ in-the-making
Champ in-the-making
"Also beware of setting an aspect as mandatory on a type after objects of that type have already been created. I messed up a repository pretty badly a while back by doing this."

OK this is what I was just about to do on a dev system; your quick reply most likely has saved me a lot of time and grief.
I guess for now this means I can't do the changes I want easily. Adding mandatory aspects to an active model could maybe be an option if I were to apply those aspects first to all data currently using that model?


I'm guessing that making it mandatory after you apply the aspect to any existing objects will not be a problem, but I've never tried.  Definitely test in your DEV system first.  I don't think it will hurt to try… if you get model bootstrap errors after adding the mandatory aspect, you should just be able to back out the change. 

tomoconnell
Champ in-the-making
Champ in-the-making
Thanks again for your reply Parzgnat.

"If you're going to delete a property from a type, you would need to delete all nodes created of that type prior to reinstalling your model"

Do you know if this is regardless of if the property is blank.
So lets say I have a type and it has a bunch of different text properties. If I wanted to remove one of the properties, and I went through and cleared this property in all the node instances of that type; would this be enough.

Or as you said would I need to completely remove every single node using that type regardless of if the specific property is blank or filled out.