Migrate Confluence short links

Jason Turner
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.
November 1, 2013

I have migrated our OnDemand Jira/Confluence to Download instances. One problem area is that some users have pasted short links to Confluencece pages in the description field of many issues.

Is there a way to have those confluence page links updated to point to our new instance? If so what is the best method to accomplish this?

1 answer

1 accepted

0 votes
Answer accepted
Jason Turner
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.
November 12, 2013

After working with support on this for over a week, host WebEx session and sending them a copy of my Jira & Confluence backups, support finally stated.

"The issue you're running into is expected, though not desired. The logic behind the jira issues macros not changing is that Confluence cannot be sure that when you're migrating to another instance that you indeed want the macros changed. They are stored (as you saw in the storage format) to point to your jira instance. Even when you change the applink to point to a new jira instance url, only new jira issues going forward will be changed. It is designed this way intentionally. The decision behind this logic is that Confluence devs stay away from changing anything in the body content of pages as a rule."

I had our DBA run the following. In the example below I replaced our instance/server name with "server1". After which links in both applications worked fine. Of course you must setup Jira and Confluence as trusted application first, I assume that was a given.

I hope this helps others.

use Confluence
go

begin tran
update BODYCONTENT
set BODY = CAST(REPLACE(CAST(BODY as NVarchar(MAX)),'>JIRA (server1.atlassian.net)<','>JIRA<') AS NText)
where patindex('%JIRA (server1.atlassian.net)%',BODY) <> 0

update BODYCONTENT
set BODY = CAST(REPLACE(CAST(BODY as NVarchar(MAX)),'6785bb03-31b0-34b6-b16a-b8700c844424','8034b128-063e-3308-8ac5') AS NText)
where patindex('%6785bb03-31b0-34b6-b16a%',BODY) <> 0
commit tran
go

use jira
go

begin tran
update remotelink
set URL = CAST(REPLACE(CAST(url as NVarchar(MAX)),'server1.atlassian.net/wiki','productmanagement.server1.com:8443') AS NText)
where patindex('%server1.atlassian.net/wiki%',URL) <> 0

update jiraissue
set description = CAST(REPLACE(CAST(description as NVarchar(MAX)),'server1.atlassian.net/wiki','productmanagement.server1.com:8443') AS NText)
where patindex('%server1.atlassian.net/wiki%',description) <> 0

update jiraaction
set actionbody = CAST(REPLACE(CAST(actionbody as NVarchar(MAX)),'server1.atlassian.net/wiki','productmanagement.server1.com:8443') AS NText)
where patindex('%server1.atlassian.net/wiki%',actionbody) <> 0
commit tran
go

Suggest an answer

Log in or Sign up to answer