Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Transition Primary Key

hp February 4, 2022

Hello Community,

 

We are developing a JIRA integration, in which we are collecting data from the JIRA API to a database. In the integration, we include different API Streams like Issues, ProjectsIssue Transitions, etc.

 

In our integration, we have used id as Primary Key for Issue Transition, but as there will be the same transition ids (11, 21, 31, ...) for multiple issues, as a result, all the issue transitions will not be uniquely identified on the database side.

 

Thus, can we use the issue id with the transition id as a set of Primary Key?

 

Thanks.

2 answers

0 votes
Nic Brough -Adaptavist-
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.
February 4, 2022

No, this is nonsense. 

The issue id is unique and immutable (the issue key is not), but the workflow transition ids are not.  The transition Open -> in progress can have a different id in different workflows, and you will find different transitions in different workflows have the same id.  And they can change as people change workflows.

What are you trying to achieve with your "integration"?  What is it trying to tell your users?

0 votes
Pramodh M
Community Champion
February 4, 2022

Hi @hp 

Welcome to the Community!!

Here's a quick thought

I'm not sure how you are handling data

For workflow, you could set the step id and associated transition id as shown below

Workflow Step ID.png

Now that your workflow will also have its own id, you could then associate this id with the issue type

Let me know what you are trying to do by storing this in the database?

Is my approach to saving the data is correct?

Let me know

Thanks

hp February 4, 2022

@Pramodh M Let me give more context on this,

 

We are developing an ETL tool for JIRA, which uses JIRA API and stores data in the database.

 

As there can be customized workflows for issues in different projects.

For example,

 

Project 1 Workflow:


11: Open

12: In Progress

13: Done

 

Project 2 Workflow:


11: Open

12: Triage

13: In Progress

14: In Review

15: Done

 

Issue 1 -> Project 1

Issue 2 -> Project 2

 

Sample issue response for reference:

Issue 1:
{
    "id": 1,
    "status": "Open",
    "transitions": [
        {
            "id": 12,
            "name": "In Progress"
        },
        {
            "id": 13,
            "name": "Done"
        }
    ]
}
Issue 2:
{
    "id": 2,
    "status": "Triage",
    "transitions": [
        {
            "id": 13,
            "name": "In Progress"
        },
        {
            "id": 15,
            "name": "Done"
        }
    ]
}

As we have used only Id as the Primary Key, for Issue Transitions and we are storing issue transitions in a different table, in total there will be 4 records for issue transition but 1 record (id: 13) will be overridden due to the same Primary Key.

We have created a field in the issue transition table called issue id which represents the issue for that transition.

Hence, can we use transition id and issue id for identifying issue transition records uniquely?

Thanks.

Nic Brough -Adaptavist-
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.
February 4, 2022

No, you can not.  See my previous answer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events