Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket notification settings database

Eric Pederson
Contributor
May 21, 2019

We've asked users to change their notification settings to Immediate but not everyone does.

I'd like to run a database query or a make REST API calls to do this in bulk for everyone.

It doesn't appear that there is a REST API for this.  What table is the data stored in?  I couldn't track it down eyeballing the Bitbucket table names and looking deeper at some of them.

1 answer

0 votes
Sujay
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2019

Hello Eric,

 

When you update the notification settings of a user, it is stored in a table called sta_shared_lob. Now this is not like the usual tables, the values for email and general notifications are not stored individually, instead they are combined into one large string and stored. For example:

lob_data

{"plugin.bitbucket-notification:email:repositoryNotificationSendMode":"BATCHED","plugin.bitbucket-notification:notificationSendMode":"BATCHED","user.created.version":"5.16.0"}

 

The best way to go about this would be to replace, the word BATCHED with IMMEDIATE in this table for all users. 

 

PLEASE NOTE: Directly manipulating the database of the production environment is not advised. Please take a backup of the DB and first perform the steps on a test bitbucket server to see if this works and nothing breaks. 

 

Run the following SQL query to replace all the occurrences of the word "BATCHED" to "IMMEDIATE":

 

UPDATE sta_shared_lob

SET lob_data = replace(lob_data, 'BATCHED', 'IMMEDIATE')

 

This query was written for a PostgreSQL DB, so please make changes appropriately for your DB type. 

 

Regards,

Sujay Raj

Eric Pederson
Contributor
May 24, 2019

Thanks Sujay -

Are there any caches that I’ll need to clear after doing this?

Eric Pederson
Contributor
May 25, 2019

It looks like some rows don't have any

"plugin.bitbucket-notification:email:repositoryNotificationSendMode":"BATCHED"

So for these I'll need to add the full

"plugin.bitbucket-notification:email:repositoryNotificationSendMode":"IMMEDIATE"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events