Solved

How to use custom code for upgrade code group when in a branch

  • 25 September 2020
  • 2 replies
  • 58 views

Userlevel 6
Badge +8

There is an option to add custom code to the Upgrade code group to do for example an insert into a table. However, how do I use this when using a branch? 

for example if I have a table with 2 rows and during development I want to add row number 3. 

 

trunk version 1        2 rows exist

   branch version 1  2 rows exist

   branch version 2  3 rows should exist    

trunk version 2        3 rows should exist

 

Branch version 2 is merged back to the trunk to create trunk v2 and trunk version 2 will be used to do the upgrade from trunk version 1 to 2. 

The actual insert is developed in branch version 2. Now I have two options: 

option 1: If I use after upgrade always then the code is in the upgrade script every release untill i delete it  manually. 

option 2 :If I use after upgrade from branch 1 to branch 2 then insert part gets lost in the trunk version 2. 

 

How do I do this correctly? If I have to do it manually in trunk version 2 then it beats the purpose of the upgrade script part. 

 

icon

Best answer by Anne Buit 29 September 2020, 12:57

Hi Erwin,

Currently, there is no elegant way to deal with this. The assumption that the upgrade between branch 1 and branch 2 is the same as the upgrade between trunk 1 and trunk 2 cannot always be made.

Furthermore, if there are 3 versions in the branch and the template is only present in branch version 2 to facilitate the upgrade between branch 1 and branch 2, it cannot be applied between trunk 1 and trunk 2 because it won’t be present in trunk 2.

In this specific case with 2 versions, using the after_upgrade_branch_1_branch_2 would be the best solution because a validation in the trunk will notify you that the template is no longer assigned in the trunk, so it can be identified and re-assigned quickly.

Technically, a dynamic model procedure can also be added that creates or updates the custom code assignments in the trunk automatically based on information of a recently merged brach.

On the backlog there is a change request (6862) for the squash task to include the custom upgrade code.

View original

2 replies

Userlevel 6
Badge +4

Hi Erwin,

Currently, there is no elegant way to deal with this. The assumption that the upgrade between branch 1 and branch 2 is the same as the upgrade between trunk 1 and trunk 2 cannot always be made.

Furthermore, if there are 3 versions in the branch and the template is only present in branch version 2 to facilitate the upgrade between branch 1 and branch 2, it cannot be applied between trunk 1 and trunk 2 because it won’t be present in trunk 2.

In this specific case with 2 versions, using the after_upgrade_branch_1_branch_2 would be the best solution because a validation in the trunk will notify you that the template is no longer assigned in the trunk, so it can be identified and re-assigned quickly.

Technically, a dynamic model procedure can also be added that creates or updates the custom code assignments in the trunk automatically based on information of a recently merged brach.

On the backlog there is a change request (6862) for the squash task to include the custom upgrade code.

Userlevel 6
Badge +8

HI Anne,

Thanks for your reply. Good to hear that there is something on the backlog for this. 

Erwin

Reply