![]() ![]() But we do not want to change the updated date (which rules out the REST API) and I don't like to use anything other than IssueService with IssueInputParameters when updating issues, which would also change the updated date. ![]() There are valid OLDKEY (=EXISTINGKEY) issue mentions in the projects previously in the target that are not supposed to be redirected.Īn alternative to SQL would be to use a script (ScriptRunner) or a custom addon with some code using the Java API. When importing the project that Jira redirection is lost.Įven if we manage to configure the redirection in the target instance from OLDKEY to NEWKEY (playing with the projectkey table) that would not be correct, because that redirection makes sense only in the scope of the imported projects. That is, source OLDKEY = target EXISTINGKEY, so OLDKEY was changed to NEWKEY in the source. The reason we are using SQL is that a bunch of projects was imported into an existing instance, but some project keys had to be changed in the source because they exist in the target. I think the reason is the dash character is not considered as word start or a word end (\n and \M in Postgres syntax. ![]() Regexp_Replace(description, '(\mOLDKEY)(- \M)', 'NEWKEY\2', 'g')īut it also matches the cases where the issue key is between dashes. I have used a simpler regex (because I know the project key) with mixed results. I tried adding \m and \M to your regex but it still matches those cases. test case TEXT1-123456789-MORETEXT, string.case OTHERTEXT-TEXT1-123456789-MORETEXT, string.However it also matches for other cases we do not want, such as It is an improvement over the one I have. At least this is true when the issue is still on the same Jira instance, which is to say if this is issue data migrated from a different Jira site then perhaps that redirect would not be expected to exist. When a project key is renamed, or issues in Jira are moved to a new project, I would expect that Jira would automatically attempt to leave a redirect for the location/issuekey of the new issue. But I'm also not sure why you are looking to change issue keys on the database level. I haven't used the postgresql regex lookup, so perhaps the syntax is a bit different there. Try that and let me know if you have any problems with that. In which case, a more precise regex could be (-*) Default value is 10, but this could be bigger or smaller in different environments. There is another possible value we need to lookup, that is back on the general settings page, it's called " Maximum project key size". I think this is optional in most cases, but just in case. However, you could try to refine this even further if need be. Next we look for the hyphen (-), and need to match at least one digit and the first digit will never be a leading zero in Jira. Ok, so the reason for this is that the first character has to be a letter (and capital letter at that), but then the project key can have either another letter or a number (but we need at least two characters for the project key), and then we can repeat the number of characters there. Using this tool I played with this for a bit and found what I think the correct expression to match a default issuekey. I really like the website of to help me figure out what my regex is going to match against using some realtime highlighting. We can use that as a base to start to figure this out. This value is actually in a regex format to begin with. This value will determine what are valid values for the project key (the part before the -1234 that we see in an issuekey such as ABC-1234). ![]() If you're a system admin, you can login to Jira and go to System > General configuration and then click the Advanced Settings button. This is because Jira server will allow a system admin to determine what is the correct patter for a Project Key to follow. However the answer here (at least for Jira Server and Data Center) could be different between systems. I understand you are looking to create a regex that will match Jira issue keys. ![]()
0 Comments
Leave a Reply. |