You are on page 1of 6

JIRA Database Schema

JIRA Database Schema


This document highlights the most commonly used parts of the JIRA database schema. We recommend using a JDBC compliant database tool, such as Squirrel SQL or DbVis, to browse the schema and become more familiar with it.

Schema Overview
The most commonly used tables in the schema are shown graphically in Illustration 1. The primary table is the jiraissue table, which contains one record for every issue in JIRA. Jiraissue is keyed into several of the other tables, although the JIRA database does not enforce foreign keys and does not actually use the same data type for foreign keys in all cases. The primary key for most tables is a unique number that is not seen or used by the users.

Jiraissue table
This table contains most of the system fields pertaining to a single issue. Table 1 lists the fields and their association to other tables in the schema. Table 1: jiraissue columns Column
Id Pkey Project Reporter Assignee Issuetype Summary Description Environment Priority Resolution issuestatus Created Updated Duedate Votes Timeoriginalestimate Timeestimate Timespent workflow_id Security Fixfor

Description Primary key, internal only Issue key known to user Project the issue belongs to Issue reporter Issue assignee Issue type

Foreign Key To
Project.id

Issuetype.id

Priority.id Resolution.id Issuestatus.id

Workflow Security level deprecated Page 1 of 6

os_wfentry.id SchemeIssueSecurityLevels.i d

Copyright 2008 The Go To Group

JIRA Database Schema Column


Component

Description deprecated

Foreign Key To

Other Common Tables Change Log


The tables changegroup and changeitem comprise JIRA's audit log. An entry in changegroup indicates one set of changes to one or more fields that occurred at the same time; the change to each individual field in a set of changes is described in changeitem. The relationship, then, is one to many between changegroup and changeitem. The relationship to jiraissue is through changegroup.issueid.
Sample query

This query selects all changes made to the field called channels.
select ji.pkey, cg.author, cg.created, ci.oldstring, ci.newstring, ci.field from jiraissue ji, changegroup cg, changeitem ci where ci.groupid = cg.id and cg.issueid = ji.id and ci.field = 'channels' order by ji.pkey

Work Log
The table worklog tracks any time logged on issues. The relationship to jiraissue is through worklog.issueid.
Sample query

This query selects all worklog entries made to any issue.


select ji.pkey, wl.author, wl.timeworked from jiraissue ji, worklog wl where wl.issueid = ji.id

Issue entities
The tables resolution, issuestatus, issuetype, and priority provide the common name and other metadata about resolutions, statuses, issue types, and priorities.

Projects and categories


The tables project and projectcategory describe the JIRA projects and their categories. The table Copyright 2008 The Go To Group Page 2 of 6

JIRA Database Schema


nodeassociation

is an unnormalized table which contains the links between projects and categories.

Sample query

This query selects any projects that has a category, along with its category.
select p.pkey, p.pname, pc.cname from project p, projectcategory pc, nodeassociation na where na.source_node_entity = 'Project' and na.sink_node_entity = 'ProjectCategory' and na.source_node_id = p.id and pc.id = na.sink_node_id

Versions
The projectversion table defines versions. The table nodeassociation is an unnormalized table which contains the links between versions and issues.
Sample query

These queries select any issues that have affects or fix versions.
select ji.pkey, pv.vname from jiraissue ji, projectversion pv, nodeassociation na where na.source_node_entity = 'Issue' and na.sink_node_entity = 'Version' and na.source_node_id = ji.id and na.association_type = 'IssueVersion' and pv.id = na.sink_node_id select ji.pkey, pv.vname from jiraissue ji, projectversion pv, nodeassociation na where na.source_node_entity = 'Issue' and na.sink_node_entity = 'Version' and na.source_node_id = ji.id and na.association_type = 'IssueFixVersion' and pv.id = na.sink_node_id

Components
The component table defines component. The table nodeassociation is an unnormalized table which contains the links between components and issues. Copyright 2008 The Go To Group Page 3 of 6

JIRA Database Schema


Sample query

These queries select any issues that have components.


select ji.pkey, c.cname from jiraissue ji, component c, nodeassociation na where na.source_node_entity = 'Issue' and na.sink_node_entity = 'Component' and na.source_node_id = ji.id and c.id = na.sink_node_id

Group membership
The table membershipbase defines the members of each group in JIRA.
Sample query

This query selects all members of the group jira-users.


select mb.user_name FROM membershipbase mb where mb.group_name = 'jira-users'

Issue links
The tables issuelink and issuelinktype describe the links between issues in JIRA, and the link metadata.
Sample query

This query selects all incoming and outgoing links for issues.
select ji.pkey, ilt.linkname from jiraissue ji, issuelink il, issuelinktype ilt where (il.source = ji.id or il.destination = ji.id) and ilt.id = il.linktype

Custom fields
The table customfield describes each custom field in the system, while customfieldvalue holds any custom field values for issues.
Sample query

This query selects all text custom field values for any issue. Copyright 2008 The Go To Group Page 4 of 6

JIRA Database Schema


select ji.pkey, cf.cfname, cfv.stringvalue from jiraissue ji, customfield cf, customfieldvalue cfv where cfv.issue = ji.id and cf.id = cfv.customfield order by ji.pkey

Copyright 2008 The Go To Group

Page 5 of 6

JIRA Database Schema

Illustration 1: Commonly used JIRA database tables

Copyright 2008 The Go To Group

Page 6 of 6

You might also like