Upgrade fails on MSSQL for add-on version 3.x

Problem

A new data structure was introduced in version 3.0.0 of the Jenkins Integration for Jira Server add-on. In this new data structure a custom primary key is used that had a string length constraint, and this constraint is not correctly mirrored by a foreign key relation.

This is a know issue of the ActiveObject framework this add-on is using (see AO-547), and the only solution is to remove the string length constraint on the primary keys.

Version 3.0.1 aims to solve this problem by removing the string length constraint on the primary keys used, but this may be blocked by the database system your Jira instance is connected to.

Solution

There is a workaround that allows you to fix the problem by resetting the ActiveObjects model upgrade marker in the database, triggering the upgrade tasks to be executed again when Jira is started. This second run should then complete the model migration.

You will require database access in order to use this workaround!

To fix this you will need to manually change the data within the database to correct the site data.

  1. Shutdown Jira
  2. Connect to you Jira database using your favourite SQL tooling that is also appropriate for the database you have.
  3. (warning) Create a backup of your database!
  4. Drop the tables of the new data model, these include: AO_3FB43F_SITES, AO_3FB43F_JOBS, AO_3FB43F_BUILDS, AO_3FB43F_TEST_RESULTS, AO_3FB43F_CHANGE_SETS, AO_3FB43F_ISSUE_LINKS
  5. Next we may need to reset the Active Objects upgrade marker for the plugin. First execute the first query below to see if there is a marker for this Active Objects module. If there is then note the ID and execute the second query as well.

    • SELECT * FROM PROPERTYENTRY WHERE PROPERTY_KEY = 'AO_3FB43F_#'

    • UPDATE PROPERTYSTRING SET PROPERTYVALUE = '0' WHERE ID = [ID]

  6. The data model has now been reset, and Jira can be started again.
  7. If the add-on was still installed and enabled, then the upgrade of the model should kick-in automatically, otherwise you can install, or enable, the add-on with Jira to trigger the data model upgrade.