We are running Atlassian Bitbucket Server for our developers and we have a backup/restore mechanism that copies the productive configuration onto a test environment. To make everything work well on the test environment, SQL scripts are used to adjust certain settings in the Bitbucket PostgreSQL database (e.g., the base URL, LDAP connection settings, etc.).
Some values in the Bitbucket database seem to be stored as text representations of java.util.Map
objects, like the key_value
field in this example of the Bitbucket look-and-feel settings (e.g., UI header color):
bitbucket=# select * from plugin_setting where key_name like 'look%';
namespace | key_name | key_value | id
---------------------------+-----------------------------+-------------------------------------+------
bitbucket.global.settings | look-and-feel:COLOR_MAP | #java.util.Map +| 7988
| | customThemePrimaryColour\x0C#abcdef+|
| | customThemeHeaderColour\x0C#9933ff |
In order to better distinguish our test and productive environments, I would like to update the key_value
with a whole new map of values, but whatever I tried so far, either had no effect (i.e., the default settings got applied) or even ended up corrupting the database and Bitbucket failed to restart. For example, I tried this, but it simply has no effect:
UPDATE plugin_setting SET key_value='#java.util.Map\ncustomThemeHeaderColour\x0C#abcdef'
WHERE key_name='look-and-feel:COLOR_MAP';
In other words, the UPDATE successfully writes the key_value
, but somehow without any line breaks (and the Bitbucket header color remains unchanged after a restart). I also tried to explicitly add a +
before the \n
line break, but that also had no effect.
It seems that I'm not correctly escaping certain characters or something...