Squash your data conversion

  • 21 January 2019
  • 0 replies
Squash your data conversion
Userlevel 3
Badge +2
During development of a project, often many project versions are created to facilitate for data-model changes. After development is complete and the production database needs to be upgraded, it is desirable to create a single script to upgrade the current production version to the final project version. This requires that the data conversion definition for all intermediate project versions is merged, or squashed, into a single data conversion from the first to the final version.

How does it work

Let’s see how it works with an example. We start out with the table customer in version 3.80. This table is renamed to clients in version 3.90, for which we create a data conversion record.

In version 4.00 we rename the table clients to client (because we always use singular nouns for entity names), so another data conversion record is created.

If you want to upgrade from version 3.80 to version 4.00 without doing an intermediate upgrade to version 3.90, you need to squash the data conversion. In the newly created data conversion definition for version 3.80 to 4.00, the table customer is directly renamed to client.

Squash task

With version 2018.1 of the Software Factory, it is possible to automatically create a squashed data conversion definition based on the data conversions of the versions in between. This can be done by using the task “Squash data conversions”.

This task will create the squashed data conversion and update the previous version. There can be as many intermediate versions as you like, they can even refer to versions in other projects (or branches).

Squashing branches

We advice to always create branches for new features. The squash-task can be used to squash data conversion in these situations as well. The new data conversion definition must include both the trunk and the branch changes. This can be done by executing the squash-task twice. In the figure below, this is demonstrated with an example.

First, merge the branch and the trunk versions to create version 4.10. Update the previous version of version 4.10 to version 4.00 and use the squash-task to consolidate the data conversion definition for version 3.80 to version 4.10.

Then update the previous version of version 4.10 to branch version 1.20. Make sure that the previous version of the first version of the branch (usually 1.00) is set to version 3.80 of the trunk. This will create a conversion path between versions 3.80 and 4.10 via the branch. When you execute the squash-task for the second time, the task will respect the existing data conversion definition and add the data conversion definitions from the branch versions.

Hope you enjoyed this post and go squash those versions!

0 replies

Be the first to reply!