Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Any way to bulk remove drafts in confluence?

Anne EQS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2016

I have approx 100 drafts and would like to bulk remove them.

And I'd like to provide this option to our users.

2 answers

1 vote
Siddheshwar mhetre
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2016

Hi Anne,

You can easily deduct the SQL you need from the SQL on that page.

You'll need to do the following :

  1. select * into temp_conf from CONTENT where CONTENTTYPE='DRAFT' (maybe change this to how it works in you DB)
  2. DELETE FROM BODYCONTENT where CONTENTID IN (select CONTENTID from temp_conf);
  3. DELETE from ATTACHMENTS where PAGEID in (select CONTENTID from temp_conf);
  4. DELETE from CONTENT where CONTENTID in (select CONTENTID from temp_conf);

Keep in mind that doing stuff in your database is not something you should consider doing lightly and is completely at your own risk.

Please take a backup before doing any changes.

Best regards,

Peter

Anne EQS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2016

Thanks - unfortunately this is nothing I can provide to our users.

 

Like # people like this
Casey Meijer April 18, 2018

This is so essential when your application creates a draft every time you open a page for editing.  In general, I've noticed that Atlassian software is *severely* lacking when it comes to bulk editing functionality *cough jira cough*. 

Like # people like this
0 votes
Daniel Fajardo January 31, 2020

USE <<ConfluenceDatabase>>

BEGIN TRANSACTION
SELECT * INTO #temp_conf FROM CONTENT WHERE (SPACEID = <<SPACEID>>) AND (CONTENTTYPE = 'PAGE') AND (CONTENT_STATUS = 'draft')

DELETE FROM CONTENT_LABEL WHERE CONTENTID IN (SELECT CONTENTID FROM #temp_conf);


DELETE FROM CONFANCESTORS WHERE DESCENDENTID IN (SELECT CONTENTID FROM #temp_conf);


DELETE FROM USERCONTENT_RELATION WHERE TARGETCONTENTID in (SELECT CONTENTID FROM #temp_conf);


DELETE FROM LINKS WHERE CONTENTID in (SELECT CONTENTID FROM #temp_conf);


DELETE FROM CONTENTPROPERTIES WHERE CONTENTID in (SELECT CONTENTID FROM #temp_conf)


DELETE FROM BODYCONTENT WHERE CONTENTID IN (SELECT CONTENTID FROM #temp_conf);


DELETE FROM CONTENT WHERE CONTENTID in (SELECT CONTENTID FROM #temp_conf);


DROP TABLE #temp_conf
--COMMIT TRANSACTION
ROLLBACK TRANSACTION

 

This worked for us in 6.14.2

Anne EQS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2020

Thanks, but still: This is a solution with database access, we need an option for our endusers.

Like # people like this
Daniel Fajardo January 31, 2020

You could create an interface around this that does the database call on their behave.  Then they access the interface to do this.   I don't know your environment, but you could create a secure REST service that does the SQL and then put a link to that REST service.  That REST service would use what ever authentication model you want to use (Active Directory, Cerfificates, ....) and that would allow you to protect against unauthorized use of this.

Like Anne EQS likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events