I am currently developing a software that needs a connection to the Alfresco database.
In this project it happens very often that the database model has to be changed. With these changes new tables and/or table columns could be added or removed.
At the moment this database model is downloaded in XML format, the existing data is deleted and after updating the database model it is uploaded again.
My question is now: is there a better solution?
First of all it is not recommended to talk to Alfresco DB directly. We should never never be updating/altering anything on db.
Could you please elaborate, what exactly you are trying to achieve ?
By model do you mean content model ?
Yes you're right I mean the content model.
I am looking for an efficent way (without losing the existing data) to change the content model (data base shema), because I will change this model by adding or deleting tables or column.
Consider using Dynamic model deployment or Model manager as alternatives.
https://docs.alfresco.com/6.0/tasks/deploy-dynamic.html
https://docs.alfresco.com/6.0/concepts/admintools-cmm-intro.html
https://docs.alfresco.com/6.0/concepts/cmm-video-tutorials.html
Thank you for your commitment
This method is a known-method to me but this method does not fulfill all the requirements that I need.
I achieved the following with the model manager:
1. adding, renaming tables or columns works
2. deleting tables or colums does not works
3. I still lost my data
Please correct me if I'm wrong. Are there any other possibilities to fullfill all my requirements.
As mentioned earlier, you should not be thinking about database and tables at all while working with content models.
It is not the right solution to alter anything on DB layer.
Think in terms of types, aspects, properties associations etc. A type approximates a table, the node approximates a row, and the property approximates a column.
You can define types, aspects and properties and apply to a node. If your requirement is that you frequently apply some properties. Define an aspect and add the properties in it and apply aspect to nodes. You can remove the aspect at any point of time based on need/code logic etc.
Later, you can choose to remove the aspect definition from content model if that is required and those properties are no longer valid for re-use. If you have requirement to re-use the same properties then leave them in content model.
I would recommend to go through these docs:
https://docs.alfresco.com/6.1/references/dev-extension-points-content-model.html
https://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html
Thank you for your commitment
Because this content you gave is new to me I have still to investigate whether it fits with my requirements.
I will try out your suggestion and send you my feedback about my test results,
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.