Advertisement
crutch12

jira - moskit -> web-bee

Apr 25th, 2024
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // @NOTE: Замена доменов в jira с oldDomain на newDomain
  2. // reference: https://confluence.atlassian.com/jirakb/how-to-update-or-change-outgoing-links-from-jira-issues-and-dashboards-1005786896.html
  3.  
  4. const oldDomain = 'moskit.pro'
  5. const newDomain = 'web-bee.ru'
  6.  
  7. const subDomains = [
  8.   'jira',
  9.   'confluence',
  10.   'bitbucket',
  11.   'jenkins',
  12.   'testit',
  13.   'vault',
  14.   'firezone',
  15.   'sut',
  16.   'nexus',
  17.   'keycloak',
  18.   'vorota',
  19.   'casl',
  20.   'gitlab',
  21.   'drive',
  22. ]
  23.  
  24. const template = `
  25. update gadgetuserpreference set userprefvalue = REPLACE(userprefvalue, 'old-url.com', 'new-url.com') where userprefvalue like '%old-url.com%';
  26. update remotelink set url = replace(url,'old-url.com','new-url.com') where url like '%old-url.com%';
  27. update remotelink set iconurl = replace(iconurl,'old-url.com','new-url.com') where iconurl like '%old-url.com%';
  28. update jiraissue set description = REPLACE(description, 'old-url.com', 'new-url.com') where description like '%old-url.com%';
  29. update jiraaction set actionbody = REPLACE(actionbody, 'old-url.com', 'new-url.com') where actiontype = 'comment' and actionbody like '%old-url.com%';
  30. update customfieldvalue set stringvalue = REPLACE(stringvalue, 'old-url.com', 'new-url.com') where stringvalue like '%old-url.com%';
  31. update customfieldvalue set textvalue = REPLACE(textvalue, 'old-url.com', 'new-url.com') where textvalue like '%old-url.com%';
  32. update "AO_550953_SHORTCUT" set "SHORTCUT_URL" = REPLACE("SHORTCUT_URL", 'old-url.com', 'new-url.com') where "SHORTCUT_URL" like '%old-url.com%';
  33. `
  34.  
  35. const result = subDomains
  36.   .map((subDomain) => {
  37.     const result = template.replaceAll('old-url.com', `${subDomain}.${oldDomain}`).replaceAll('new-url.com', `${subDomain}.${newDomain}`)
  38.     return `-- ${subDomain}.${oldDomain} -> ${subDomain}.${newDomain}\n${result}`
  39.   })
  40.   .join('\n')
  41.  
  42. console.log('RUN IN SQL JIRA SERVER')
  43. console.log(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement