How to change the preferred order of User Directores in Bamboo Data Center via the database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When migrating Bamboo from one environment to another it may sometimes be necessary to change the preferred order of user directories directly via the database.
Environment
The solution has been validated in Bamboo 8.1 but may be applicable to other versions.
Solution
Considerations
The directory preference is specified in the list_index column of the cwd_app_dir_mapping table in the Bamboo directory.
The database uses a numerical value to indicate preference with the lower numbers (starting at 0) being the higher preference.
The cwd_app_dir_mapping table uses the directory_id as the primary key to identify the directories.
You can associate the directory_id to a directory name by getting the directory_id and directory_name columns from the cwd_directory table.
Once you have the directory_id values you can update the list_index for those directories, making the new primary's list_index value 0, and adjusting the values of other directories accordingly.
Before taking any action on the database you'll want to be sure to create a backup of your Bamboo environment.
Be sure that no value for the list_index column is duplicated to prevent directory conflicts.
You will need to stop Bamboo prior to making any modification to the database, and restart Bamboo once the changes are complete.
Step-by-step
Run this SQL query to list directory IDs and names:
1
SELECT id, directory_name FROM cwd_directory;
Identify the ID of the new primary directory (
$newPrimary
).Run this query to set it as primary, replacing
$newPrimary
with the ID of the directory:1
UPDATE cwd_app_dir_mapping SET list_index = 0 WHERE directory_id = $newPrimary;
Identify the ID of the old primary directory that will now be the secondary directory (
$newSecondary
).Run this query to set it as secondary, replacing
$newSecondary
with the ID of the directory:1
UPDATE cwd_app_dir_mapping SET list_index = 1 WHERE directory_id = $newSecondary;
Run this query to confirm the changes:
1
SELECT * FROM cwd_app_dir_mapping;
Commit the changes.
This process updates the directory priorities in your Bamboo setup. Upon restarting the app, they should take effect for login.
Was this helpful?