Resyncing update scripts with a new reference database

Hi

We are about to deliver a somewhat big project in production and we would like to ensure we don’t break the production database with update scripts.

The update scripts we have in the project are the reflect of a development process: columns and tables have been added, then removed, the model has been changing and passing through refactoring several times.

So we are not confident in launching the (numerous) updates scripts on the production database.

What I would like to do is recreate update scripts in the project based on the actual structure of the production database.

So I did export structure of production database on an homologation database, regenerated update scripts. Checked the scripts, they are ok, but when I update database I have the below error. Cuba tries to create table sys_server, which already exists.

Is there a way to progress on the topic ? Any help would be appreciated.

image

Regards
Michael

Hi,
I think that when you “export structure of production database”, you always need to include the contents of the SYS_DB_CHANGELOG table to the database dump. This table remembers previously executed scripts.

Otherwise platform database scripts that were already executed in the past, will try to execute one more time. When you are re-generating database scripts, only project’s scripts are generated. Scripts inherited from platform and add-ons are included as is.

It did the trick, thanks @albudarov

Michael