Database query to rename multiple deployment environments in Bamboo
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
This KB helps in updating or renaming the names of the environments belonging to deployment projects. You can use the below query to update or rename multiple deployment environments in bulk.
Environment
Tested the query in Bamboo 7.2.4 with PostgreSQL.
Solution
Important
Please backup your database before running any update, Insert or delete queries.
SQL to list all the deployment environments
1
select * from public.deployment_environment;
SQL to update deployment environments name in bulk.
1 2 3 4 5
UPDATE public.deployment_environment SET name = CASE name WHEN 'OLD_ENV_NAME1' THEN 'NEW_ENV_NAME1' WHEN 'OLD_ENV_NAME2' THEN 'NEW_ENV_NAME2' ELSE name END WHERE name IN('OLD_ENV_NAME1', 'OLD_ENV_NAME2');
Was this helpful?