How to change the creator of a page
Atlassian does not support customers performing direct data manipulation of application databases via queries, the information provided in this knowledge base article should be used at your own risk. For more information, please see the Atlassian Support Offerings.
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Problem
This guide will help you change the creator of a page to a different user. Changing the creator of a page is not generally recommended, but we understand that under some circumstances it might be required.
Resolution
The procedure you will follow to change the creator will depend on the version of Confluence you use, because 'userkeys' were introduced in Confluence 5.2 to allow for users to be renamed.
Always backup your data before performing any modifications to the database.
For Confluence 5.2 and above
To change the creator of a specific page
Run this SQL query against your database, replacing these values:
- <lowerusername> with the username of the new creator in lower case
- 'the title of the page' with the page title (case sensitive)
- <thespacekey> with the spacekey in uppercase
update content set creator = (select user_key from user_mapping where lower_username = '<lowerusername>')
where contentid in (select c2.contentid from content c2 where c2.title = 'the title of the page'
and spaceid = (select spaceid from spaces where spacekey = '<thespacekey>'))
or prevver in (select c2.contentid from content c2 where c2.title = 'the title of the page'
and spaceid = (select spaceid from spaces where spacekey = '<thespacekey>'));
Alternatively, pageid of the content can be used instead of the title. See How to get Confluence page ID for further details
- <lowerusername> with the username of the new creator in lower case
- <pageid> with the page id
update content set creator = (select user_key from user_mapping where lower_username = '<lowerusername>')
where contentid = '<pageid>' or prevver = '<pageid>';
To replace all content created by a single user
Run this SQL query against your database, replacing these values:
- <newlowerusername> with the username of the new creator in lower case
- <oldlowerusername> with the username of the old creator in lower case
update content set creator = (select user_key from user_mapping where lower_username = '<newlowerusername>')
where creator = (select user_key from user_mapping where lower_username = '<oldlowerusername>');
Finally, from within the Confluence UI, we'll need to flush the cache. Navigate to Cog > *General Configuration* > Administration > Cache Management and click on 'Flush All’.
For Confluence 5.1 and below
To change the creator of a specific page
Run this SQL query against your database, replacing these values:
- <lowerusername> with the username of the new creator in lower case
- 'the title of the page' with the page title (case sensitive)
- <thespacekey> with the spacekey in uppercase
update content set creator = '<lowerusername>'
where contentid in (select c2.contentid from content c2 where c2.title = 'the title of the page'
and spaceid = (select spaceid from spaces where spacekey = '<thespacekey>'))
or prevver in (select c2.contentid from content c2 where c2.title = 'the title of the page'
and spaceid = (select spaceid from spaces where spacekey = '<thespacekey>'));
To replace all content created by a single user
Run this SQL query against your database, replacing these values:
- <newlowerusername> with the username of the new creator in lower case
- <oldlowerusername> with the username of the old creator in lower case
update content set creator = '<newlowerusername>'
where creator = '<oldlowerusername>';