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.
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>'));
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>');
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>';