I have approx 100 drafts and would like to bulk remove them.
And I'd like to provide this option to our users.
Hi Anne,
You can easily deduct the SQL you need from the SQL on that page.
You'll need to do the following :
select
*
into
temp_conf
from
CONTENT
where
CONTENTTYPE=
'DRAFT' (maybe change this to how it works in you DB)
DELETE
FROM
BODYCONTENT
where
CONTENTID
IN
(
select
CONTENTID
from
temp_conf);
DELETE
from
ATTACHMENTS
where
PAGEID
in
(
select
CONTENTID
from
temp_conf);
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
Thanks - unfortunately this is nothing I can provide to our users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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*.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, but still: This is a solution with database access, we need an option for our endusers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.