Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Active objects upgrade task development for JIRA plugin

Tomasz Stec
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2014

Hi,

I am working on a JIRA (6) plugin which operates with a few AO entities. Upgrade tasks was never needed, because db model was unchanged... until now. I already tried to write simple upgrade task by implementing ActiveObjectsUpgradeTask interface. I think i know what to do to perform whole upgrade task but i have no idea how can i test it...

I already tried to:

  1. uninstall plugin,
  2. drop tables connected with plugin,
  3. install again plugin from the oldest version to the newest.

The upgrade tasks (upgrade() method) has never executed.

During my researches i figured out inside AO framework theres ActiveObjectUpgradeManager class and more precisely ModelVersionManager class which manages ModelVersion-s for every plugin that uses AO.

My question is how can i manage plugin's AO ModelVersion manually. Or maybe there's better, solution?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Mikhail_Kopylov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2015

Plugin AO version is stored in application properties.

  • Find row in table `propertyentry ` with entity_name='jira.properties' and property_key = 'AO_??????_#' with your plugin hash key there.
  • Find row in table `propertystring` with id from previous found row.

You can remove or edit these properties when JIRA is stopped.

 

pelizza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2016

Hey @Omickron,

Thank you very much for that! I've been looking for it for a long time laugh

Cheers!

vinit k shah October 3, 2018

Thank you very much :)

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2019

Here SQL for Mikhail's answer:

select ps.* from propertyentry pe inner join propertystring ps on pe.id = ps.id where entity_name='jira.properties' and property_key = 'AO_XXXXXX_#'
0 votes
IgorYastrebov October 6, 2015

One possible reason could be:

look at your atlassian-plugin.xml

<ao key="ao-module">
  <description>The AO module for the plugin.</description>
  <entity>com.atlassian.XXXX.aabb</entity>
<upgradeTask>com.atlassian.XXXX.v1.Upgrade001</upgradeTask>
</ao>

Full class name inside <upgradeTask></upgradeTask> could have a wrong path/name. In that case, no error/warning in the log and the plugin looks valid. But Upgrade001.java class will not be triggered.

0 votes
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2014

Did you include the upgrade task in you plugin xml as documented here?

Upgrades wont fire until AO initializes, its lazily intialized to solve timing problems during JIRA boot. Depending on you addon that could be the first database dependant Action, a job etc.

Whilst in development build/deploy cycles, just keep incrementing the model number to force an upgrade, but for release testing, always drop all data, rollback to an earlier release from empty, and then deploy the upgrade.

AO has the capabilities built in to help manage object migration, works well, just time consuming to test.

Tomasz Stec
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2014

thanks Andy,
Incrementing model number works fine for testing... But the problem is that i need to perform release tests. Data deletion does't work, because AO somehow retains my plugin's specific model version number... I thought it would be enough to drop plugin specific AO tables, but it's not :(

PS. sry, i didn't answer before, had other work to do...

Adrien Ragot 2
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2018

To reset your tables to a previous model number:
delete from bandana where bandanakey = 'AO_123456_#'; -- Replace 123456 with the hash of your plugin, which is also the prefix of your tables. Keep the #, it means "model number".

TAGS
AUG Leaders

Atlassian Community Events