mysql> select * from projectversion where id in ( select SINK_NODE_ID from nodeassociation where ASSOCIATION_TYPE='IssueFixVersion' and SOURCE_NODE_ID=( select id from jiraissue where pkey='JRA-5351') ); +-------+---------+-------+-------------+----------+----------+----------+------+-------------+ | ID | PROJECT | vname | DESCRIPTION | SEQUENCE | RELEASED | ARCHIVED | URL | RELEASEDATE | +-------+---------+-------+-------------+----------+----------+----------+------+-------------+ | 11614 | 10240 | 3.6 | NULL | 131 | NULL | NULL | NULL | NULL | +-------+---------+-------+-------------+----------+----------+----------+------+-------------+
Similarly with affects versions:
1 2 3 4 5 6 7 8 9 10 11
mysql> select * from projectversion where id in ( select SINK_NODE_ID from nodeassociation where ASSOCIATION_TYPE='IssueVersion' and SOURCE_NODE_ID=( select id from jiraissue where pkey='JRA-5351') ); +-------+---------+---------------------+-------------+----------+----------+----------+------+---------------------+ | ID | PROJECT | vname | DESCRIPTION | SEQUENCE | RELEASED | ARCHIVED | URL | RELEASEDATE | +-------+---------+---------------------+-------------+----------+----------+----------+------+---------------------+ | 10931 | 10240 | 3.0.3 Professional | NULL | 73 | true | NULL | NULL | 2004-11-19 00:00:00 | | 10930 | 10240 | 3.0.3 Standard | NULL | 72 | true | NULL | NULL | 2004-11-19 00:00:00 | | 10932 | 10240 | 3.0.3 Enterprise | NULL | 74 | true | NULL | NULL | 2004-11-19 00:00:00 | +-------+---------+---------------------+-------------+----------+----------+----------+------+---------------------+
and components:
1 2 3 4 5 6 7 8 9
mysql> select * from component where id in ( select SINK_NODE_ID from nodeassociation where ASSOCIATION_TYPE='IssueComponent' and SOURCE_NODE_ID=( select id from jiraissue where pkey='JRA-5351') ); +-------+---------+---------------+-------------+------+------+--------------+ | ID | PROJECT | cname | description | URL | LEAD | ASSIGNEETYPE | +-------+---------+---------------+-------------+------+------+--------------+ | 10126 | 10240 | Web interface | NULL | NULL | NULL | NULL | +-------+---------+---------------+-------------+------+------+--------------+
Issue links
1 2 3 4 5 6 7 8 9 10 11
mysql> desc issuelink; +-------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------+------+-----+---------+-------+ | ID | decimal(18,0) | NO | PRI | | | | LINKTYPE | decimal(18,0) | YES | MUL | NULL | | | SOURCE | decimal(18,0) | YES | MUL | NULL | | | DESTINATION | decimal(18,0) | YES | MUL | NULL | | | SEQUENCE | decimal(18,0) | YES | | NULL | | +-------------+---------------+------+-----+---------+-------+ 5 rows in set (0.00 sec)
For instance, to list all links between TP-1 and TP-2:
1 2 3 4 5 6 7
mysql> select * from issuelink where SOURCE=(select id from jiraissue where pkey='TP-1') and DESTINATION=(select id from jiraissue where pkey='TP-2'); +-------+----------+--------+-------------+----------+ | ID | LINKTYPE | SOURCE | DESTINATION | SEQUENCE | +-------+----------+--------+-------------+----------+ | 10020 | 10000 | 10000 | 10010 | NULL | +-------+----------+--------+-------------+----------+ 1 row in set (0.00 sec)
Link types are defined in issuelinktype. This query prints all links in the system with their type:
1 2 3 4 5 6 7 8 9 10 11 12
mysql> select j1.pkey, issuelinktype.INWARD, j2.pkey from jiraissue j1, issuelink, issuelinktype, jiraissue j2 where j1.id=issuelink.SOURCE and j2.id=issuelink.DESTINATION and issuelinktype.id=issuelink.linktype; +-------+---------------------+-------+ | pkey | INWARD | pkey | +-------+---------------------+-------+ | TP-4 | jira_subtask_inward | TP-5 | | TP-4 | jira_subtask_inward | TP-7 | | TP-4 | jira_subtask_inward | TP-8 | | TP-11 | jira_subtask_inward | TP-12 | | TP-4 | jira_subtask_inward | TP-6 | | TP-1 | is duplicated by | TP-2 | +-------+---------------------+-------+ 6 rows in set (0.00 sec)
Subtasks As shown in the last query, JIRA records the issue-subtask relation as a link. The “subtask” link type is hidden in the user interface (indicated by the ‘pstyle’ value below), but visible in the database:
1 2 3 4 5 6 7 8
mysql> select * from issuelinktype; +-------+-------------------+---------------------+----------------------+--------------+ | ID | LINKNAME | INWARD | OUTWARD | pstyle | +-------+-------------------+---------------------+----------------------+--------------+ | 10000 | Duplicate | is duplicated by | duplicates | NULL | | 10001 | jira_subtask_link | jira_subtask_inward | jira_subtask_outward | jira_subtask | +-------+-------------------+---------------------+----------------------+--------------+ 2 rows in set (0.00 sec)
Custom fields Custom fields defined in the system are stored in the customfield table, and instances of custom fields are stored in customfieldvalue:
This query identifies a particular custom field value in a particular issue:
1 2 3 4 5 6 7
mysql> select stringvalue from customfieldvalue where customfield=(select id from customfield where cfname='Urgency') and issue=(select id from jiraissue where pkey='FOR-845'); +-------------+ | stringvalue | +-------------+ | Low | +-------------+ 1 row in set (0.33 sec)
If the custom field has multiple values (multi-select or multi-user picker), each issue can have multiple customfieldvalue rows:
1 2 3 4 5 6 7 8
mysql> select * from customfieldvalue where customfield=(select ID from customfield where cfname='MultiUser'); +-------+-------+-------------+-----------+-------------+-------------+-----------+-----------+-----------+ | ID | ISSUE | CUSTOMFIELD | PARENTKEY | STRINGVALUE | NUMBERVALUE | TEXTVALUE | DATEVALUE | VALUETYPE | +-------+-------+-------------+-----------+-------------+-------------+-----------+-----------+-----------+ | 10002 | 10060 | 10000 | NULL | bob | NULL | NULL | NULL | NULL | | 10003 | 10060 | 10000 | NULL | jeff | NULL | NULL | NULL | NULL | +-------+-------+-------------+-----------+-------------+-------------+-----------+-----------+-----------+ 2 rows in set (0.00 sec)
Here issue 10060 has two users, bob and jeff in its MultiUser custom field.