Updating database

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Updating database

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?

6 Replies
Highlighted
Moderator
Moderator

Re: Updating database

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 ? 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)
Highlighted
Member II

Re: Updating database

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.

Highlighted
Moderator
Moderator

Re: Updating database

Highlighted
Member II

Re: Updating database

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. 

Highlighted
Moderator
Moderator

Re: Updating database

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

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)
Highlighted
Member II

Re: Updating database

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,