kapua icon indicating copy to clipboard operation
kapua copied to clipboard

FEATURE - Change order of execution of liquibase changelogs based on release number

Open Agnul97 opened this issue 1 year ago • 1 comments

The order of execution of liquibase changelogs was based on the usage of some master changelog files, defined for each module containing liquibase scripts. These master files defined the order of execution of changelogs but did not prioritize the version number to order the executions of them. Here a new way of executing changelogs is proposed that executes them ordering on the version number. This means that, first, all changelogs of the first release are executed, then all changelogs of the second release, and so on. Consider the case in which, for example, a certain script for a version changed the name of a table or column, and some liquibase scripts of an older version still reference the old name...it is important to execute those scripts in order of version. This kind of problem could happen taking into account the module "kapua-foreignkeys": think the case where the definition of a foreign key references a table that has been renamed, at a point in future time, by another changelog.

Description of the solution adopted The kapuaLiquibaseClient has been properly updated to implement the new ordering of changelogs executions.

A global addition to changelog files was needed: the inclusion of a reference to the common.xml file. In fact, before, thanks to the usage of master changelogs files, it could happen that some of the first changelogs were including this common file, and then the subsequent changelogs in the chain would pick it indirectly from the common "context".

Some changelogs were not adhering to the pre-post ordering principle so I modified their names.

Agnul97 avatar Sep 28 '23 14:09 Agnul97

Codecov Report

Merging #3881 (2081813) into develop (b42f840) will increase coverage by 0.01%. The diff coverage is 92.85%.

:exclamation: Current head 2081813 differs from pull request most recent head a03685a. Consider uploading reports for the commit a03685a to get more accurate results

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3881      +/-   ##
=============================================
+ Coverage      20.58%   20.59%   +0.01%     
  Complexity         6        6              
=============================================
  Files           1936     1936              
  Lines          41532    41542      +10     
  Branches        3945     3947       +2     
=============================================
+ Hits            8549     8557       +8     
- Misses         32586    32587       +1     
- Partials         397      398       +1     
Files Coverage Δ
.../kapua/commons/liquibase/KapuaLiquibaseClient.java 80.35% <92.85%> (-0.04%) :arrow_down:

codecov[bot] avatar Sep 29 '23 07:09 codecov[bot]