RE: Database update on new service builder version

Nils Wilmet, modified 6 Years ago. New Member Posts: 20 Join Date: 4/24/19 Recent Posts
Hi everyone,
We are making a service builder for all of our REST web services. We wanted to apply continuous integration. It works well except for the deploy : if there is an update or add of an entity in the service.xml file, there is an error of "Already existing relationship" on our tables, which does not happen in development. This error completely stops the deployment process.

Is there a way to update database automatically during deployment without crushing existing tables and data ?
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Nils Wilmet:

Is there a way to update database automatically during deployment without crushing existing tables and data ?
Check LPS-67688 for a discussion of the background, and instructions on how to write the appropriate upgrade process (or use the developer-workaround) - find some updated working links to documentation in the last comment to the issue, and look for your version's documentation.
Nils Wilmet, modified 6 Years ago. New Member Posts: 20 Join Date: 4/24/19 Recent Posts
Hi Olaf,

Thanks for the reply. I did read the "Creating Data Upgrade Processes for Modules" tutorial.And from what I understood, we need to make some sort of SQL statements at each schema update ? It's too bad because we lose the automatic process of deploying a new version, and for the CI it would force the developer to write down each new modification before integration...If there is any other way to do that, i'll take it emoticon
Thanks a lot !
thumbnail
Alberto Chaparro, modified 6 Years ago. Liferay Master Posts: 560 Join Date: 4/25/11 Recent Posts
Hi Nils,There are two ways to apply new changes to your current schema:
- Following the official procedure that Olaf has explained. We follow that approach in Liferay and it's not a big deal and we also have continuous integration, I don't know why a new process that executes the changes can be a problem for that.
- Make the SQL changes by yourself in some other way if you don't care about tracking every schema change. We support 6 different database vendors so any schema change needs to be tracked with a specific schema version but maybe in your case, it's easier and you don't need it.Apart from this, please take into account the following link if you upgraded from WAR to Osgi module a service builder plugin:https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/upgrade-processes-for-former-service-builder-plugins
Nils Wilmet, modified 6 Years ago. New Member Posts: 20 Join Date: 4/24/19 Recent Posts
Hi Alberto,

Thanks for your help. We managed to build some SQL script to backup data before deleting tables, recreate them and insert data again.

Thanks again for all your useful informations !
thumbnail
Alberto Chaparro, modified 6 Years ago. Liferay Master Posts: 560 Join Date: 4/25/11 Recent Posts
Glad to hear that!